Repository navigation
fix(memory): validate namespace on memory store and memory import - #3571
Merged
Merged
Conversation
…vnet#3570) The CLI store path and memory_import wrote a namespace containing ../, which memory export and purge reject, leaving entries they cannot read or clean up. Validate with validateIdentifier before any write; import checks every entry first so a bad file persists nothing.
…rt, export and purge (ruvnet#3570 follow-up) Follow-up to drakeo338's fix, closing the remaining gaps found in review: - Keys: MCP memory_store rejected `../` in keys, but CLI `memory store` and `memory_import` accepted it. The MCP rule (DANGEROUS_KEY_PATTERN) is now exported through `memoryKeyError()` and used by all three; import checks every key up front, so a bad file writes nothing. Keys with a plain `/` (`probe/x`) stay legal. - Purge: `purgeNamespace` used its own NAMESPACE_PATTERN, which rejected `:`, so `team:alice` could be stored and exported but never purged. It now uses `validateIdentifier`, like the other three operations. - MCP memory_store: namespaces only faced the key blacklist, so `proj/sub` was accepted there but rejected by export and purge. It now uses `validateIdentifier` too. Tests added to memory-store-import-namespace-3570.test.ts: each gap fails on the prior head and passes here, plus a round-trip table asserting that CLI store, MCP store and purge accept exactly the namespaces export accepts. Co-Authored-By: drakeo338 <[email protected]> Co-Authored-By: RuFlo <[email protected]>
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.
Fixes #3570.
memory storeand thememory_importtool accepted a namespace containing../and wrote it, whilememory exportand purge reject that namespace. The entries were left in the database where neither command could read or clean them up. Both paths now runvalidateIdentifieron the namespace before any write, and import checks every entry first so a bad file persists nothing.Added tests in
memory-store-import-namespace-3570.test.ts; they fail on the base commit and pass with the change.