Skip to content

fix(tools): enforce configured container scope - #1504

Closed
abhinav7x94 wants to merge 3 commits into
supermemoryai:mainfrom
abhinav7x94:fix/tools-enforce-container-scope
Closed

abhinav7x94 wants to merge 3 commits into
supermemoryai:mainfrom
abhinav7x94:fix/tools-enforce-container-scope

Conversation

@abhinav7x94

Copy link
Copy Markdown
Contributor

Summary

  • treat configured containerTags and projectId as a strict allowlist for model-callable operations
  • apply the same resolver to AI SDK and OpenAI profile, document-list, and memory-forget tools
  • fail closed when the configured scope is empty or a requested tag is outside it
  • add no-I/O regressions for all six affected operations

Why

The affected tools used containerTag || containerTags[0], so a model-supplied tag replaced the developer-configured tenant scope. With a broader API key, that allowed profile/document reads and soft deletion outside the configured container.

A requested tag is now accepted only when it is present in the configured set; omission still selects the first configured tag for compatibility.

Validation

  • focused tests: 30 passed
  • full package suite: 98 passed, 30 skipped; the two suite-load failures are pre-existing (missing SUPERMEMORY_API_KEY and a broken relative test import)
  • production package build passed
  • Biome and git diff --check passed
  • package typecheck remains baseline-red in existing SDK/dependency/example code, with no new helper/test diagnostic

Coordination

Open PR #1453 adds four more model-callable operations using the old fallback expression. If it lands, those new sites should adopt resolveConfiguredContainerTag during rebase; this PR is complete against current main.

Comment thread packages/tools/src/tool-operations.test.ts Outdated
Comment thread packages/tools/src/tool-operations.test.ts Outdated
@MaheshtheDev

Copy link
Copy Markdown
Member

🤖 AI-assisted triage, reviewed by @MaheshtheDev.

Thanks! Replaced by the v5 migration (#1773): tools now use one configured namespace and no longer accept a tag from the model. Closing.

@capy-ai

capy-ai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Thanks @abhinav7x94. This fix shipped in @supermemory/tools@2.3.1, published to npm under the legacy-2 dist-tag (release PR #1824, credited to you as co-author). Your allowlist resolver now guards getProfile, documentList and memoryForget on both the AI SDK and OpenAI tool surfaces.

2.x users get it with npm install @supermemory/tools@2.3.1, or automatically on their next update if they depend on ^2.x. Tools 3.x doesn't need it, because it no longer lets the model choose the container tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants