Repository navigation
fix(mcp,sharing): redact project keys, session ids and branch names in the payload - #1337
Merged
iamtoruk merged 2 commits intoSep 13, 2026
Conversation
redactProjectNames rebuilt every row with a spread and replaced only the fields it knew about, so identities added to the payload later rode through untouched with include_project_names: false: - topSessions[].projectKey, the raw sessions-list row key, is a dash-encoded absolute working directory (-Users-<user>-Projects-<repo>). Hash it with the project pseudonym, the way topProjects[].id already is. - topSessions[].sessionId and topProjects[].sessionDetails[].sessionId are the drill-through identity; a Codex id also carries the rollout timestamp this pass blanks out of `date`. Hash them as session-xxxxxx. provider stays: it is claude/codex, not identity. - byBranch[].branch is the raw git branch, which encodes ticket ids, customer names and feature codenames. Give each distinct branch a stable branch-xxxxxx pseudonym and keep the row's numbers. A null branch stays null: that is unbranched spend, not a name. The new pseudonyms are domain-separated inside the digest so a branch and a project of the same name do not share a hash; the project pseudonym itself is unchanged. redactSessionDetails now takes its type from the payload instead of a hand-copied inline type that had drifted from it, which is why the leak type-checked. include_project_names: true is unchanged. Refs getagentseal#1325, getagentseal#1321
sanitizeForSharing spread current and emptied only topProjects and topSessions, so the per-branch rows added with the payload block went out verbatim: a branch such as exp/extraction-arms reached a peer device as typed. Branch names encode ticket ids, customer names and feature codenames, so they get what project and session rows get and leave the payload entirely. Pseudonymizing was the alternative, but a branch-a1b2c3 row means nothing on another device's dashboard, and no shared surface reads the block today. Refs getagentseal#1321, getagentseal#1325
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.
Two identity fields were riding along in the menubar payload and coming out the other side of the redaction passes untouched.
current.topSessions[].projectKey— added with the drill-through rows in #1316 — is the raw sessions-list row key: a dash-encoded absolute working directory like-Users-me-Projects-acme.redactProjectNamesrebuilt each row with a spread and replaced onlyproject, so a client callingget_usagewithinclude_project_names: falsestill got the working directory of every top session sitting next to the pseudonymized name. The same spread carried the drill-throughsessionIdthrough, on those rows and ontopProjects[].sessionDetails— where the pass deliberately blanksdate, and a Codex session id has the rollout timestamp inside it.current.byBranch[].branch— the per-branch rows from #788 — is the raw git branch, and neithersanitizeForSharingnorredactProjectNamestouched the block, so a branch likeexp/extraction-armsreached a shared payload and an MCP client exactly as typed. Branch names carry ticket ids, customer names and codenames; they belong with the project names.What changes:
include_project_names: false:projectKeyis hashed with the same salted pseudonym astopProjects[].id(same kind of value, same namespace, so one directory hashes to one pseudonym in both places),sessionIdbecomessession-xxxxxx, and each distinct branch becomes a stablebranch-xxxxxx. Cost, calls and session counts are untouched. Anullbranch staysnull— that row is unbranched spend, not a name.provideris left alone; it isclaude/codex, not identity.include_project_names: trueis unchanged: every name still comes through as recorded. The local menubar, the desktop app and the web dashboard read the unsanitized payload, so nothing changes for them; the app's branch lens is fed by its own CLI report over IPC, not by this block, and I checked that nothing indash/,app/,mac/,windows/orgnome/readspayload.current.byBranchat all.One trade-off I want a second opinion on: for sharing I strip the branch rows rather than pseudonymize them. Pseudonymized branches would tell a peer device nothing, stripping is what project and session rows get today, and no shared surface renders the block — but it does mean per-branch spend can never appear on a combined multi-device dashboard without revisiting this. If you'd rather keep the aggregates and lose only the name, reusing the MCP pseudonym is a one-liner — with the caveat that the pseudonym salt would then start leaving the device.
Verification: the new cases fail on main and pass here. Targeted run (
tests/mcp-redact.test.ts,tests/sharing/sanitize.test.ts,tests/menubar-json.test.ts) is 53 passed across the three files (13 + 5 + 35);npx tsc --noEmitis clean; the full suite is 4087 passed / 10 failed, and each of those 10 is a CLI-subprocess test that timed out under parallel load — the seven affected files pass on their own with this branch applied (70/70). I also reverted the two source files with the new tests in place to confirm they fail for the right reason, then restored them.One thing this PR does NOT fix, on purpose:
current.pullRequestssurvives both passes verbatim, andPrRowcarries the full PRurlplus anowner/repo#123label, so the repository owner and name reach a shared payload and a name-redacted MCP client. Same class of leak as #1321, arguably worse than a branch name. I'd rather file it separately than widen this PR.Fixes #1325
Fixes #1321