Skip to content

Commit 0cd7dc4

Browse files
authored
fix(services): redact 'private key' from the agent-action public-safe card (#8020) (#8027)
PUBLIC_FORBIDDEN_PATTERN in agent-action-explanation-card.ts listed seed phrases and mnemonics but not private keys, so an App-credential reference in why/blockedBy leaked through publicSafe unredacted. The term is present in all five sibling public-redaction vocabularies (miner-dashboard- recommendations.ts, control-panel-roles.ts, decision-pack.ts, weekly-value-report.ts, extension-contributor-context.ts); add the same 'private keys?' alternative here. Regression test pins the redaction.
1 parent 3962d99 commit 0cd7dc4

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/services/agent-action-explanation-card.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type AgentActionExplanationInput = Pick<
88

99
const BLOCKER_CATEGORY_ORDER: AgentActionBlockerCategory[] = ["branch", "account", "queue", "scoreability", "risk", "maintainer", "unknown"];
1010
const PUBLIC_FORBIDDEN_PATTERN =
11-
/\b(wallets?|hotkeys?|coldkeys?|seed phrases?|mnemonics?|raw[-_\s]?trust scores?|trust scores?|private reviewability|reviewability internals?|private scoreability|scoreability|projected scores?|score(?:d|s|ability)?|public score estimates?|estimated scores?|score estimates?|score previews?|reward estimates?|payouts?|farming|reward optimization|private rankings?)\b/gi;
11+
/\b(wallets?|hotkeys?|coldkeys?|seed phrases?|mnemonics?|private keys?|raw[-_\s]?trust scores?|trust scores?|private reviewability|reviewability internals?|private scoreability|scoreability|projected scores?|score(?:d|s|ability)?|public score estimates?|estimated scores?|score estimates?|score previews?|reward estimates?|payouts?|farming|reward optimization|private rankings?)\b/gi;
1212
const PUBLIC_SCORE_DELTA_PATTERN = /\b(?:projected\s+)?score\w*(?:\s+\w+){0,4}\s+[-+]?\d+(?:\.\d+)?\s*->\s*[-+]?\d+(?:\.\d+)?\b/gi;
1313
// Token alternatives stay local; the local-path alternatives compose from the canonical PUBLIC_LOCAL_PATH_INLINE
1414
// in redaction.ts (adds the previously-missed /root/ and /var/, plus the forward-slash Windows form C:/Users/).

test/unit/agent-orchestrator.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,24 @@ describe("agent orchestrator", () => {
804804
expect(card.publicSafe.summary).not.toMatch(/\/root\/work|\/var\/log|C:\/Users\/alice/);
805805
});
806806

807+
it("redacts 'private key' from the public-safe card, matching its sibling redaction lists (#8020)", () => {
808+
// `private keys?` was present in 5 sibling public-redaction vocabularies (miner-dashboard-recommendations.ts:45,
809+
// control-panel-roles.ts:297, decision-pack.ts:1438, weekly-value-report.ts:417, extension-contributor-context.ts:31)
810+
// but missing here, so an App-credential reference leaked through publicSafe.whyNow unredacted.
811+
const card = buildAgentActionExplanationCard({
812+
actionType: "choose_next_work",
813+
status: "blocked",
814+
why: ["Blocked by a private key rotation on the App credential."],
815+
blockedBy: ["private key rotation pending"],
816+
publicSafeSummary: "Resolve the App private key rotation before rerunning.",
817+
safetyClass: "private",
818+
});
819+
820+
expect(card.publicSafe.summary).not.toMatch(/private key/i);
821+
expect(card.publicSafe.summary).toMatch(/private context/);
822+
expect(card.publicSafe.whyNow).not.toMatch(/private key/i);
823+
});
824+
807825
it("does not split a surrogate pair when truncating a card field at the 300-character cap", () => {
808826
// A string is well-formed UTF-16 iff it has no lone surrogate (a high surrogate not followed by a
809827
// low one, or a low surrogate not preceded by a high one). Equivalent to String#isWellFormed without

0 commit comments

Comments
 (0)