fix(mcp): resolve security access scope bypass in getDocument tool

This commit is contained in:
Aditya kumar singh 2026-08-27 23:15:01 +05:30
parent f11d8c4620
commit 2e444ff8cd

View file

@ -32,9 +32,12 @@ export function register(deps: ToolDeps) {
const effectiveTag = await deps.resolveContainerTag()
const client = deps.getClient()
const document = await client.getDocument(args.documentId)
const docTags = document.containerTags
const docTags = Array.isArray(document.memoryEntries)
? document.memoryEntries
.map((entry: any) => entry.spaceContainerTag)
.filter(Boolean)
: []
if (
Array.isArray(docTags) &&
docTags.length > 0 &&
!docTags.includes(effectiveTag)
) {