diff --git a/src/services/miner-dashboard-recommendations.ts b/src/services/miner-dashboard-recommendations.ts index f4b1bd9b44..4b474b7910 100644 --- a/src/services/miner-dashboard-recommendations.ts +++ b/src/services/miner-dashboard-recommendations.ts @@ -43,6 +43,7 @@ const REASON_LIMIT = 3; const FORBIDDEN_PUBLIC_TEXT = /\b(wallets?|hotkeys?|coldkeys?|seed phrases?|mnemonics?|private keys?|raw[-_\s]?trust(?: scores?)?|trust[-_\s]?scores?|reward(?:[-_\s]?(?:estimate|prediction|claim|score))?s?|payouts?|farming(?:[-_\s]?language)?|private[-_\s]?reviewability|private[-_\s]?scoreability|scoreability|public[-_\s]?score[-_\s]?(?:estimate|prediction)|estimated[-_\s]?score|score[-_\s]?estimate)\b/gi; const LOCAL_PATH = /(?:\/(?:Users|home|root|tmp|var)\/[^\s,;:)]+|[A-Za-z]:\\Users\\[^\s,;:)]+)/g; +const FORBIDDEN_TOKEN = /\b(?:ghp_|github_pat_|gts_|glpat-|sk-)[A-Za-z0-9_=-]{8,}/g; export function previousDecisionPackFromSnapshots(currentPack: ContributorDecisionPack, snapshots: SignalSnapshotRecord[]): ContributorDecisionPack | undefined { const current = asRecord(currentPack); @@ -383,6 +384,7 @@ function numberValue(record: DashboardRecord | undefined, key: string): number | function sanitizePublicText(value: string): string { return value .replace(LOCAL_PATH, "[local path]") + .replace(FORBIDDEN_TOKEN, "private context") .replace(FORBIDDEN_PUBLIC_TEXT, "private context") .replace(/\s+/g, " ") .trim(); diff --git a/test/unit/miner-dashboard-recommendations.test.ts b/test/unit/miner-dashboard-recommendations.test.ts index 6597104248..4e3aab7474 100644 --- a/test/unit/miner-dashboard-recommendations.test.ts +++ b/test/unit/miner-dashboard-recommendations.test.ts @@ -54,7 +54,7 @@ describe("miner dashboard recommendation metadata", () => { { repoFullName: "JSONbored/gittensory", actionKind: "open_new_direct_pr", - rerunWhen: "Rerun when queue changes, not wallet hotkey scoreability reward estimate.", + rerunWhen: "Rerun when queue changes, not wallet hotkey scoreability reward estimate ghp_abcd1234EFGH5678ijkl.", }, ], },