fix(review): give score-breakdown.ts its own vocabulary instead of the public sanitizer - #6473
Merged
Merged
Conversation
explainScoreBreakdown() piped its own contributor-facing "explain my score" copy through sanitizePublicComment (src/github/commands.ts), the shared sanitizer for genuinely public GitHub comment surfaces. This endpoint (POST /v1/scoring/explain-breakdown, gated by requireContributorAccess) is authenticated and scoped to the requesting contributor's OWN score, not a public GitHub comment -- so "score" and "credibility" are its legitimate core vocabulary, not a leak. The shared sanitizer was mangling both terms into "private context" throughout this feature's own output. Mirrors the established, documented pattern in agent-action-explanation-card.ts / miner-dashboard-recommendations.ts (see src/signals/redaction.ts's note above PUBLIC_UNSAFE_TERMS): this endpoint's output is entirely computed, structured score data, so the only genuine residual risk is an accidentally-embedded token or local filesystem path -- keep just that minimal safety net instead of the full gittensor-economic- vocabulary substitution. Unblocks a planned follow-up: once this file no longer depends on sanitizePublicComment, that shared sanitizer can safely add bare-"score" redaction (already added to queue-intelligence.ts's sanitizer in #6460) without breaking this feature.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
❌ 3 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/services/score-breakdown.ts'sexplainScoreBreakdown()piped its own contributor-facing "explain my score" copy throughsanitizePublicComment(src/github/commands.ts), the shared sanitizer for genuinely public GitHub comment surfaces (@loopovermention-command replies, etc.).This endpoint (
POST /v1/scoring/explain-breakdown, and the matching MCP tool) is gated byrequireContributorAccess— an authenticated, per-contributor "explain your own score" surface, not a public GitHub comment. Its copy legitimately and pervasively says "score" and "credibility" by design. Reusing the public sanitizer mangled its own output: "saturated near the score cap" → "saturated near the private context cap", "Contributor credibility evidence..." → "Contributor private context evidence...".Gives
score-breakdown.tsits own small, local, curated sanitizer — keeping only a token/local-filesystem-path safety net (this endpoint's output is entirely computed, structured score data, so that's the only genuine residual risk) — instead of the full gittensor-economic-vocabulary substitution. Mirrors the established, documented pattern already used byagent-action-explanation-card.ts/miner-dashboard-recommendations.ts(seesrc/signals/redaction.ts's note abovePUBLIC_UNSAFE_TERMS).Unblocks a planned follow-up: now that this file no longer depends on
sanitizePublicComment, that shared sanitizer can safely add bare-scoreredaction (already added toqueue-intelligence.ts's sanitizer in #6460) without breaking this feature — closing a gap that PR deliberately left open for exactly this reason.Test plan
test/unit/score-breakdown.test.tspass;score-breakdown.tsat 100% line/branch coverage (one pre-existing, unrelated branch gap noted, not introduced by this change)npm run test:ci) green