Repository navigation
Scrub credentials out of exported metadata, not just exported text - #370
Merged
Merged
Conversation
#74 slice 1 redacted content and issue at serialisation and left the metadata fields as stored. New writes cannot carry a credential in scope/tags/kw (the schema rejects control characters, the write boundary rejects credential-shaped metadata), but a row stored before those checks — or hand-edited into the store — exported its token verbatim into a file meant to leave the machine. Same rule as slice 1: redact the value being serialised, never the row. repo and repoPath stay as stored: they are derived stamps, and rewriting them would break the import-side validation that keeps a portable file honest. RED first: a legacy row whose scope and a tag hold an sk- token exported the token. GREEN: the exported line carries [redacted] and the store file is byte-unchanged. write-caps' legacy-row pin, which asserted the old verbatim export, now asserts the new contract and additionally pins that the STORE still holds the original scope and secret (redaction stays forward-only). README: the limits bullet no longer claims memory_export writes everything verbatim.
Owner
Author
Adversarial self-review (author-side, not independent)Attacked the "leave Verified clean:
Findings:
Verdict: approve. Branch is 23 commits behind |
|
🎉 This PR is included in version 0.22.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Owner
Author
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.
What this does
memory_exportwrites your memories to a JSONL file you can hand to another machine. Since #74 it scrubs credentials out of the memory text on the way out, because a row stored before credential-checking existed can still hold a token. It did not scrub the metadata on the same row:scope,tags, andkw(the search keywords) were written exactly as stored.New writes cannot put a credential in those fields — the tool schema refuses control characters and the write boundary refuses credential-shaped metadata. The gap is for rows that predate those checks, and for a store someone edited by hand: exporting one shipped the token verbatim in a file whose whole purpose is leaving the machine.
This closes it with the rule #74 already stated in that file — redact the value being serialised, never the row. The store is not rewritten; only the export copy is scrubbed.
What is deliberately left alone:
repoandrepoPath. Those are derived origin stamps, not prose, and the import side validates them — rewriting them would break the check that stops a portable file from claiming a repository it did not come from.Consequences worth knowing
[redacted]where a credential was stored, inscope,tags,kw,contentandissue.memory_undoand the viewer still see the original bytes.Tests
scopeand ataghold ansk-token exported the token.[redacted]in all three metadata fields, and the store file is byte-identical before and after the export.write-caps: "legacy secrets remain verbatim…"). It now asserts the new contract, and additionally pins that the store still holds the original credential-shaped scope and secret — redaction stays forward-only. Recall and forget by that scope still work, which is what that test was really about.bun run gategreen: 1129 unit tests + 30 terminal/BDD tests against a real host, 0 fail.bunx tsc --noEmitclean; lint and format identical to main's baseline.Closes #300.