fix(rules): honor alreadyPublicSafe in check-run annotations (#8321)#8459
Conversation
…ed#8321) formatCheckRunOutput already renders a finding's publicText verbatim when it declares alreadyPublicSafe (JSONbored#7981): the flag marks a fixed, engineer-authored message with no interpolated contributor/AI content, so running it through sanitizeForCheckRun would mangle a deliberately-worded string (turning "...secret, wallet, PAT..." into "...secret, [context], PAT..."). buildCheckRunAnnotations renders those same findings as inline annotations, but its addCandidate helper sanitized the message unconditionally -- so one finding on one PR showed verbatim in the check-run text and scrubbed in the annotation, reintroducing the bug class JSONbored#7981 fixed in a sibling path it did not touch. addCandidate now takes an alreadyPublicSafe flag (default false) and skips the message sanitizer when set, mirroring formatCheckRunOutput's conditional exactly. The title keeps its sanitizer: there is no per-title safety flag on a finding, so nothing licenses skipping it. Findings without the flag are unchanged -- the default keeps the other two addCandidate call sites byte-identical. Adds two tests pinning both arms on the annotation path: an alreadyPublicSafe finding renders verbatim, and one without the flag is still sanitized.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8459 +/- ##
==========================================
- Coverage 92.43% 89.70% -2.73%
==========================================
Files 791 98 -693
Lines 79320 23028 -56292
Branches 23952 4012 -19940
==========================================
- Hits 73317 20657 -52660
+ Misses 4866 2187 -2679
+ Partials 1137 184 -953
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 14:31:34 UTC
Review summary Nits — 3 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. 🟩 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.
|
Summary
Closes #8321.
formatCheckRunOutputinsrc/rules/advisory.tsalready honors a finding'salreadyPublicSafeflag when building the check-runtext:Per #7981, that flag marks a fixed, engineer-authored message with no interpolated contributor/AI content, so scrubbing it would mangle a deliberately-worded string -- e.g. turning
"...secret, wallet, PAT..."into"...secret, [context], PAT...".buildCheckRunAnnotationsrenders those same findings as inline annotations, but itsaddCandidatehelper sanitized the message unconditionally and never received the flag. The result: one finding, on one PR, rendered verbatim in the check-runtextbut scrubbed in the annotation for that same finding -- reintroducing the exact bug class #7981 fixed, in a sibling path #7981 didn't touch.Change
addCandidatenow takes analreadyPublicSafeparameter (defaulting tofalse) and skips the message sanitizer when it is set, mirroringformatCheckRunOutput's conditional exactly.addCandidatecall sites (missing-test evidence, duplicate overlap) untouched.Tests
Two tests pinning both arms on the annotation path, placed beside the existing #7981
formatCheckRunOutputtest so the pair reads together:alreadyPublicSafefinding's annotation message renders verbatim (no[context]placeholder)Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #8321).Validation
git diff --checknpm run actionlint- no workflow files touched.npm run typechecknpx vitest run test/unit/rules.test.ts- 101 pass (was 99).[1, 164]), the?? falseat the call site takes both ([31, 30]), and the new default-arg is exercised ([165]) by the two untouched call sites.npm run test:coverage(full) /test:workers/build:mcp/ui:*- not run: this is a scoped change to one backend module plus its unit test, touching no worker, MCP, or UI surface.npm audit --audit-level=moderate- no dependency changes.Safety
sanitizeForCheckRun.UI Evidencesection - n/a: no visible UI/frontend/docs/extension change.Notes