mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 10:43:47 +00:00
fix(sharing,mcp): drop or pseudonymize pull request rows in redacted payloads
current.pullRequests survived both sanitizeForSharing and redactProjectNames(include_project_names: false) verbatim, so each row's full GitHub url and owner/repo#123 label named the repository to a paired peer device and to a name-redacted MCP client — the same class of leak Sharing drops the block like it drops the project, session and per-branch rows. The MCP pass pseudonymizes url and label from the url (the aggregation key) with the same salted, domain-separated hash as the other pseudonyms, so rows referring to the same PR still line up and every number stays untouched. Closes #1346
This commit is contained in:
parent
554ce6714a
commit
af0f23d09d
5 changed files with 66 additions and 1 deletions
|
|
@ -46,6 +46,14 @@ function sessionPseudonym(id: string): string {
|
|||
return `session-${hashed(`session:${id}`)}`
|
||||
}
|
||||
|
||||
/// PR rows name the repository in both the full URL (the aggregation key) and
|
||||
/// the `owner/repo#123` label, so a caller that asked not to see project names
|
||||
/// must not see them either. Pseudonymized from the URL so rows referring to
|
||||
/// the same PR still line up; the numbers stay untouched.
|
||||
function prPseudonym(url: string): string {
|
||||
return `pr-${hashed(`pr:${url}`)}`
|
||||
}
|
||||
|
||||
type SessionDetails = MenubarPayload['current']['topProjects'][number]['sessionDetails']
|
||||
|
||||
function redactSessionDetails(details: SessionDetails): SessionDetails {
|
||||
|
|
@ -91,6 +99,18 @@ export function redactProjectNames(payload: MenubarPayload, includeNames: boolea
|
|||
})),
|
||||
}
|
||||
: {}),
|
||||
...(payload.current.pullRequests
|
||||
? {
|
||||
pullRequests: {
|
||||
...payload.current.pullRequests,
|
||||
rows: payload.current.pullRequests.rows.map(row => ({
|
||||
...row,
|
||||
url: prPseudonym(row.url),
|
||||
label: prPseudonym(row.url),
|
||||
})),
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
history: {
|
||||
...payload.history,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ export function sanitizeForSharing(payload: MenubarPayload): MenubarPayload {
|
|||
// Per-branch rows are keyed by the raw git branch, which encodes ticket ids,
|
||||
// customer names and feature codenames as readily as a project name does, so
|
||||
// they leave with the project and session rows rather than travelling verbatim.
|
||||
const { byBranch: _byBranch, ...current } = payload.current
|
||||
// PR rows carry the repository owner and name in both the full URL and the
|
||||
// `owner/repo#123` label, so they travel with them.
|
||||
const { byBranch: _byBranch, pullRequests: _pullRequests, ...current } = payload.current
|
||||
return {
|
||||
...rest,
|
||||
current: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue