fix(review): scan patch-less PR files for leaked secrets - #3464
fix(review): scan patch-less PR files for leaked secrets#3464RealDiligent wants to merge 1 commit into
Conversation
) Extract patch-less secret-scan enrichment into patchless-secret-scan.ts with full unit coverage. When GitHub omits inline diff for binary/large files, fetch head/base content via Contents API and synthesize scannable + lines before the unconditional secret_leak hard blocker runs. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - reject/close recommendedReview updated: 2026-07-05 08:13:31 UTC
🛑 Suggested Action - Reject/Close
Review summary Blockers
Nits — 6 non-blocking
Why this is blocked
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
|
Gittensory is closing this pull request on the maintainer's behalf (No linked issue detected; Maintainer requires a linked issue; AI reviewers agree on a likely critical defect: src/queue/patchless-secret-scan.ts:123 passes `SECRET_SCAN_PATCH_FALLBACK_MAX_CHARS` to `getFileContent`, so a fetcher that honors `maxChars` can return a 512000-character truncated prefix and make `isOverSecretScanContentLimit` unable to fail closed for an oversized head file; request `SECRET_SCAN_PATCH_FALLBACK_MAX_CHARS + 1` for head/base reads and then keep the existing `> SECRET_SCAN_PATCH_FALLBACK_MAX_CHARS` check, e.g. `const readLimit = SECRET_SCAN_PATCH_FALLBACK_MAX_CHARS + 1; const headContent = await args.fetcher.getFileContent(file.path, headSha, readLimit);`.). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (98.73%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #3464 +/- ##
==========================================
+ Coverage 93.01% 93.02% +0.01%
==========================================
Files 297 298 +1
Lines 31013 31091 +78
Branches 11310 11338 +28
==========================================
+ Hits 28846 28923 +77
Misses 1512 1512
- Partials 655 656 +1
🚀 New features to boost your workflow:
|
…SONbored#3464) Co-authored-by: Cursor <cursoragent@cursor.com>
…#3493) * fix(review): scan patch-less PR files for leaked secrets (#2821) Extract patch-less secret-scan enrichment into patchless-secret-scan.ts with full unit coverage. When GitHub omits inline diff for binary/large files, fetch head/base content via Contents API and synthesize scannable + lines before the unconditional secret_leak hard blocker runs. Co-authored-by: Cursor <cursoragent@cursor.com> * test(review): cover default-status branch for patch-less secret scan (#3464) Co-authored-by: Cursor <cursoragent@cursor.com> * fix(review): use +1 fetch probe for patch-less secret scan cap (#3481) The grounding FileFetcher returns maxChars+1 when content exceeds the cap; pass SECRET_SCAN_FETCH_PROBE_CHARS so oversized files fail closed instead of scanning a truncated prefix. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(review): precheck patch-less fetch and cap incomplete-path detail Skip makeGithubFileFetcher when every file already has inline patch. Cap fail-closed advisory path list (title keeps full count). Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Problem
The unconditional
secret_leakhard blocker scans only+lines frombuildSecretScanDiff. GitHub omits inlinepatchfor binary/large changed files (>~1 MB), so those files produced header-only entries with no scannable body. A PR could commit a concrete credential in a patch-less file and pass the gate.Fix
src/queue/patchless-secret-scan.tswith dedicated unit tests (100% line coverage).headShais available at gate time, fetch head/base content via Contents API and synthesize scannable+lines for patch-less added/modified/renamed files.Test plan
npm run typechecktest/unit/patchless-secret-scan.test.ts(41 tests)test/unit/safety-wiring.test.ts(unchanged, passes)