fix(orb): one shared token-redaction pattern across the five public surfaces (#9697) - #9918
fix(orb): one shared token-redaction pattern across the five public surfaces (#9697)#9918kai392 wants to merge 1 commit into
Conversation
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-29 23:46:01 UTC
Review summary Nits — 1 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Decision record
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…urfaces (JSONbored#9697) Four hand-written token-redaction patterns guarded public-facing text in src/services/**, and every one missed something another caught. The worst gap: three surfaces (miner-dashboard-recommendations, control-panel-roles, weekly-value-report) matched only `ghp_`, so `ghs_` -- the GitHub App INSTALLATION token this Worker mints on every pass -- passed through a public dashboard string, role summary, and weekly report verbatim. The two path surfaces (score-breakdown, agent-action-explanation-card) matched the correct `gh[pousr]_` GitHub class but not the Orb/GitLab/Slack prefixes the others caught. - src/signals/redaction.ts: add PUBLIC_TOKEN_INLINE (the alternation source of every prefix -- `gh[pousr]_`, github_pat_, gts_, orbenr_, orbsec_, glpat-, sk-, xox[baprs]-) and publicTokenPattern() returning a FRESH /g RegExp each call, the credential analogue of the existing PUBLIC_LOCAL_PATH_INLINE / PUBLIC_LOCAL_PATH_SCRUB_PATTERN. - All five surfaces now compose from that single source, each keeping its own replacement string and its own trailing body class / path alternation; no hand-written prefix literal remains under src/services/. Tests: a REGRESSION ghs_ case on miner-dashboard; an it.each over every prefix on control-panel-roles, weekly-value-report, score-breakdown, and a new agent-action-explanation-card test file; publicTokenPattern() fresh- object + repeated-.replace() idempotency in redaction.test. Each site also asserts a non-token string is left unmodified. Closes JSONbored#9697 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9918 +/- ##
===========================================
- Coverage 91.86% 79.71% -12.16%
===========================================
Files 921 287 -634
Lines 113263 59130 -54133
Branches 27300 8873 -18427
===========================================
- Hits 104046 47133 -56913
- Misses 7929 11706 +3777
+ Partials 1288 291 -997
Flags with carried forward coverage won't be shown. Click here to find out more.
|
What
Four hand-written token-redaction patterns guarded public-facing text in
src/services/**, and every one missed something another caught. The worst gap: three surfaces (miner-dashboard-recommendations,control-panel-roles,weekly-value-report) matched onlyghp_, soghs_— the GitHub App installation token this Worker mints on every pass viacreateInstallationToken— passed through a public dashboard string, role summary, and weekly report verbatim. The two path surfaces (score-breakdown,agent-action-explanation-card) matched the correctgh[pousr]_GitHub class but not the Orb/GitLab/Slack prefixes the others caught.How
src/signals/redaction.ts: addPUBLIC_TOKEN_INLINE(the alternation source of every prefix —gh[pousr]_,github_pat_,gts_,orbenr_,orbsec_,glpat-,sk-,xox[baprs]-) andpublicTokenPattern()returning a fresh/gRegExpon each call — the credential analogue of the existingPUBLIC_LOCAL_PATH_INLINE/PUBLIC_LOCAL_PATH_SCRUB_PATTERN.gh[pousr]_is the correct GitHub class (same assrc/review/secret-patterns.ts), coveringghp_/gho_/ghu_/ghs_/ghr_at once."private context","<redacted-token>","<redacted>") and its own trailing body class / path alternation. No hand-written prefix literal remains undersrc/services/.Tests
miner-dashboard-recommendations: a namedREGRESSIONcase for theghs_installation-token gap.control-panel-roles,weekly-value-report,score-breakdown, and a newagent-action-explanation-cardtest file: oneit.eachover every prefix inPUBLIC_TOKEN_INLINE, plus a non-token string left unmodified per site.redaction.test:publicTokenPattern()returns a fresh object each call and a repeated.replace()is idempotent (guards the shared-lastIndexregression).134 tests pass across the six files; the old patterns provably miss
ghs_/xoxb-(non-vacuous).Closes #9697