Repository navigation
fix(tools): keep model-supplied containerTag inside the configured scope (2.3.1) - #1824
Merged
Merged
Conversation
…ope (2.3.1) getProfile, documentList, memoryForget and documentDelete accept an optional containerTag from the model and used it as the request scope unchecked, so a model or prompt-injected input could read profiles, list documents, forget memories or delete documents under another tenant's tag. Both the AI SDK and OpenAI tool surfaces now resolve that tag through resolveConfiguredContainerTag, which only allows tags the developer configured and rejects anything else before any request is made. Backport of #1504 (profile, list, forget) and #1758 (documentDelete) onto the 2.3.0 release commit, with their regression tests. Co-authored-by: abhinav7x94 <raj.abhinav7x94@gmail.com> Co-authored-by: shamAnimates <145093437+shamAnimates@users.noreply.github.com> Co-authored-by: Atharvsinh-codez <at41rv@gmail.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | f9a0964 | Oct 16 2026, 10:30 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | f9a0964 | Commit Preview URL Branch Preview URL |
Oct 16 2026, 10:31 PM |
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security backport for the
@supermemory/tools2.x line. Targetsrelease/tools-2.x, which points atd0f53b0d, the exact commit npm's provenance attestation records for 2.3.0. This does not touchmain: Tools 3.x (#1773) already removed model-selected scope.Problem
In 2.x,
getProfile,documentList,memoryForgetanddocumentDeleteaccept an optionalcontainerTagfrom the model and use it unchecked as the request scope. So a model, or a prompt-injected input, can name another tenant's tag and read their profile, list their documents, forget their memories, or delete their documents.Fix
resolveConfiguredContainerTagtotools-shared.ts. A model-supplied tag must be one of the tags the developer configured (containerTags, theprojectId-derived tag, or the default). Otherwise the call fails withContainer tag "…" is outside the configured scope.before any request is sent. When no tag is supplied, the old defaults still apply: the first configured tag for profile and forget, the configured union for list and delete.ai-sdk.tsandopenai/tools.ts. The other tools (searchMemories,addMemory,documentAdd) don't accept a model-supplied scope. The middleware, Mastra, VoltAgent and Claude memory surfaces take their scope only from developer options.Provenance
Ported from two closed external PRs, which were closed only because 3.x superseded them:
[string, ...string[]]scope union.The regression tests are carried over from both PRs:
tools-shared.test.ts, theconfigured container scopeblock intool-operations.test.ts, anddocument-delete-scope.test.ts, which is now added totest:unit. One adaptation: in 2.3.0,getContainerTagsalready rejectscontainerTags: []when the tool is constructed, so the "fails closed when the configured scope is empty" case asserts the throw at construction. #1755 adapted the test the same way.Verification
Run in
packages/tools:bun run test:unit: 114/114 pass. The 2.3.0 base passes 101/101.configured container scopeand 3 indocumentDelete configured container scope. All pass with the fix.bun run build: passes.bun run check-types: 146 errors both before and after. These are pre-existing AI SDKtool()overload errors, and the normalized error set is identical, so this change adds none.bunx biome ci packages/tools/src: no new findings. The 3 warnings are pre-existing, inclaude-memory-simple-example.ts.Release
publish-tools.ymltriggers only on pushes tomain, and with npm ≥11 a plainnpm publishof 2.3.1 is refused whilelatestis 3.1.2. So this release needs a manual or one-off publish with--tag, run after merge. The thread report has the steps.