fix(review): scan added lines whose content starts with ++ for secrets - #5952
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-15 04:56:49 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
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://gittensory.aethereal.dev/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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5952 +/- ##
=======================================
Coverage ? 95.14%
=======================================
Files ? 589
Lines ? 46605
Branches ? 14889
=======================================
Hits ? 44344
Misses ? 1511
Partials ? 750
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Closes #5942
PR body
Summary
scanDiffForSecretsWithLocationshad a leftover!line.startsWith("+++")guardmeant to skip unified-diff
+++ b/pathfile headers. This scanner never sees thoseheaders — file boundaries are already owned by
DIFF_FILE_HEADER_PATTERN(
### path (status) +N/-N). The guard's only live effect was to misclassify agenuine added line whose content starts with
++(after the diff+markerthe line looks like
+++…), fall through to the context-line path, and nevercall
matchedKindsIn. A committed secret on such a line silently bypassed theunconditional
secret_leakhard blocker.Change
src/review/secrets-scan.ts: remove the stale!line.startsWith("+++")guard so any line starting with
+is scanned as an added line. All otherclassifications (
DIFF_FILE_HEADER_PATTERN,DIFF_HUNK_HEADER_PATTERN,--prefixed removals, context lines) are unchanged.matchedKindsInand thefile-header path-scanning branch are untouched.
Tests (
test/unit/secrets-scan.test.ts)+++ token: ghp_… +++is detected asgithub_tokenat the correct file:line.+line; removed/lines unscanned).### path (status) +N/-Nfile headers are not falsely scanned as contentlines (
line > 0).line: 0) still works.Coverage
src/review/secrets-scan.tsremains at full patch coverage for the touchedlines (the change deletes a branch condition; the new tests exercise the remaining
startsWith("+")path including content that previously tripped the guard).Links