fix(public-safety): redact score numbers in 'estimated score N -> M' wording - #930
Conversation
…wording sanitizePublicComment stripped the raw score-transition numbers only for the effective/projected prefixes, but the score engine (buildGateDeltas) emits the 'estimated score N -> M' wording — so 'estimated score 32.5 -> 41.2' was only half-redacted (words replaced, numbers leaked) into every explain-breakdown response, which runs each string through this sanitizer to be public-safe. Add 'estimated' to the number-stripping pattern and a catch-all that clears any residual numeric transition left after a phrase replacement.
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
🔍 Maintainer reviewReviewed 2 file(s) — ✅ all CI green. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Worth double-checking
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #930 +/- ##
=======================================
Coverage 96.61% 96.61%
=======================================
Files 110 110
Lines 14928 14928
Branches 5399 5399
=======================================
Hits 14422 14422
Misses 104 104
Partials 402 402 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
sanitizePublicComment(the shared public-safety sanitizer) redacts the raw score-transition numbers (N -> M) only for theeffective/projectedprefixes — but not for theestimated scoreprefix, which is the exact wording the score engine (buildGateDeltas) actually emits. So a gate-delta explanation is only half-sanitized: the wordsestimated scorebecomeprivate context, but the raw internal scores survive.Running the real sanitizer on the real engine wording:
These strings flow into every
gittensory_explain_score_breakdown/POST /v1/scoring/explain-breakdownresponse, which runs each one through this sanitizer precisely to be public-safe (src/services/score-breakdown.tsgateHighlightsFor→sanitizePublicComment(delta.explanation)). The estimated score is a product-defined private "scoreability" value (estimated score/score estimate/scoreabilityare forbidden public terms), so leaking the raw number is a scoreability leak by the project's own definition.The sanitizer's contract —
test/unit/github-commands.test.ts— asserts the score-transition numbers are redacted, but only forprojected/effective; it never covered theestimated scoreprefix the engine uses, so the gap shipped green.Fix
estimatedto the number-stripping pattern, soestimated score N -> Mis fully redacted (matches the engine's wording).score estimate/score previewfollowed byN -> M), so the same class of half-redaction can't recur for sibling phrases.Tests
Added regression assertions for the
buildGateDeltaswording (estimated score 32.5 -> 41.2,... 18 -> 27) and the residual catch-all (score estimate 5 → 9) — all asserting the numbers are gone, not just the words. Full unit suite green locally (2218 passed; only the known local-only CRLFgittensory-focus-manifesttest fails locally, passes in CI).Closes #929