Skip to content

fix(review): scan patch-less PR files for leaked secrets - #3484

Closed
RealDiligent wants to merge 4 commits into
JSONbored:mainfrom
RealDiligent:fix/secret-scan-patchless-files-v5
Closed

fix(review): scan patch-less PR files for leaked secrets#3484
RealDiligent wants to merge 4 commits into
JSONbored:mainfrom
RealDiligent:fix/secret-scan-patchless-files-v5

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Problem

GitHub omits inline patch for binary/large PR files; the unconditional secret_leak gate only scanned inline diff + lines.

Fix

  • src/queue/patchless-secret-scan.ts — Contents API fallback with +1 fetch probe so oversized files fail closed.
  • Wired into maybeAddSecretLeakFinding at gate time.

Pre-PR validation

  • npm run typecheck
  • test/unit/patchless-secret-scan.test.ts — 41 tests, 100% patch coverage

Supersedes closed #3481 (codecov passed; bot flagged fetch-cap semantics, fixed in v5).

RealDiligent and others added 4 commits July 5, 2026 16:50
)

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>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ored#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>
@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 5, 2026 09:36
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 5, 2026
@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-05 09:40:55 UTC

3 files · 1 AI reviewer · 1 blocker · readiness 80/100 · CI green · clean

🛑 Suggested Action - Reject/Close

  • AI reviewers agree on a likely critical defect: PR description: this PR only says it supersedes closed fix(review): scan patch-less PR files for leaked secrets #3481 and does not close or clearly link an eligible open issue in this repo
  • link the maintainer-authorized issue this fixes, or explain why this is maintainer-authorized despite the repo convention. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
The change correctly wires a bounded Contents API fallback into the deterministic secret scan path and fails closed when patch-less files cannot be fetched or exceed the scan cap. The helper logic is well-covered for added, modified, renamed, oversized, and fetch-error cases, and the gate still scans any inline patches when fallback enrichment fails. I do not see a reachable correctness defect in the provided diff, but the PR description does not close or clearly link an eligible open issue, which this repo requires before merge.

Blockers

  • PR description: this PR only says it supersedes closed fix(review): scan patch-less PR files for leaked secrets #3481 and does not close or clearly link an eligible open issue in this repo; link the maintainer-authorized issue this fixes, or explain why this is maintainer-authorized despite the repo convention.
Nits — 4 non-blocking
  • src/queue/processors.ts:6758: nit: the fallback fetcher is constructed whenever `headSha` is present, even when every file already has an inline patch, so consider checking for at least one patch-less eligible file before minting a GitHub fetcher.
  • src/queue/patchless-secret-scan.ts:89: nit: `paths.join(", ")` can produce a very large advisory detail on PRs with many unscannable files, so consider capping the displayed path list and reporting the total count.
  • src/queue/processors.ts:6758: add a small precheck such as `files.some((file) => !file.payload?.patch && shouldAttemptPatchLessSecretScan(...))` before calling `makeGithubFileFetcher`, or tell me why the extra token/API setup cost is acceptable on every scanned PR.
  • src/queue/patchless-secret-scan.ts:89: cap the incomplete finding detail to the first N paths plus `and X more` so a pathological PR cannot bloat the advisory comment.

Why this is blocked

  • PR description: this PR only says it supersedes closed fix(review): scan patch-less PR files for leaked secrets #3481 and does not close or clearly link an eligible open issue in this repo; link the maintainer-authorized issue this fixes, or explain why this is maintainer-authorized despite the repo convention.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #3481
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 138 registered-repo PR(s), 18 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 138 PR(s), 0 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: Ruby, Svelte, TypeScript, Cuda, JavaScript, Markdown
  • Official Gittensor activity: 138 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.05%. Comparing base (a979552) to head (57df627).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3484      +/-   ##
==========================================
+ Coverage   93.03%   93.05%   +0.01%     
==========================================
  Files         298      299       +1     
  Lines       31203    31282      +79     
  Branches    11386    11414      +28     
==========================================
+ Hits        29029    29108      +79     
  Misses       1518     1518              
  Partials      656      656              
Files with missing lines Coverage Δ
src/queue/patchless-secret-scan.ts 100.00% <100.00%> (ø)
src/queue/processors.ts 93.40% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (AI reviewers agree on a likely critical defect: PR description: this PR only says it supersedes closed #3481 and does not close or clearly link an eligible open issue in this repo; link the maintainer-authorized issue this fixes, or explain why this is maintainer-authorized despite the repo convention.). 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant