Skip to content

fix(review): detect secrets split across adjacent added lines (#2454) - #2824

Closed
RealDiligent wants to merge 7 commits into
JSONbored:mainfrom
RealDiligent:fix/secret-scan-cross-line-split
Closed

fix(review): detect secrets split across adjacent added lines (#2454)#2824
RealDiligent wants to merge 7 commits into
JSONbored:mainfrom
RealDiligent:fix/secret-scan-cross-line-split

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Port review-enrichment cross-line literal join into the unconditional secret_leak gate (scanPrDiffForSecretKinds).
  • Credentials split across consecutive + lines (e.g. two string literals joined at runtime) can no longer evade per-line regex matching.
  • Preserves hunk/context boundaries and patch-less synthetic diffs from fix(review): scan patch-less PR files for leaked secrets #2821.

Test plan

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 3, 2026 20:33
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@755499d). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2824   +/-   ##
=======================================
  Coverage        ?   96.04%           
=======================================
  Files           ?      258           
  Lines           ?    28248           
  Branches        ?    10252           
=======================================
  Hits            ?    27132           
  Misses          ?      489           
  Partials        ?      627           
Files with missing lines Coverage Δ
...ges/gittensory-engine/src/opportunity-freshness.ts 95.23% <100.00%> (ø)
src/review/safety.ts 100.00% <100.00%> (ø)
src/review/secrets-scan.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 3, 2026


Exercise empty-line section breaks, orphan + lines, removed-line join reset,
added/renamed header paths, generic cross-line assignment, and the
already-matched skip path so Codecov patch coverage meets 99%.

Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 3, 2026
@loopover-orb

loopover-orb Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-04 00:18:28 UTC

6 files · 1 AI reviewer · no blockers · readiness 73/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The secret-scanning change correctly moves the hard gate to a diff-aware scanner and covers the main added-line, header, hunk-boundary, and adjacent-literal cases. The most notable issue is not in that path: this PR also changes engine freshness behavior and an engine barrel export outside the stated secret-leak fix, so the diff is bundled beyond the PR description. I do not see a visible reachable correctness break in the provided changed files.

Nits — 7 non-blocking
  • nit: packages/gittensory-engine/src/opportunity-freshness.ts:26 is unrelated to the PR title/description; split this freshness scoring change into its own PR or explain why it belongs with secret split-line detection.
  • nit: packages/gittensory-engine/src/index.ts:49 is unrelated barrel-export churn in this PR; keep this out of the secret scanner change unless another file in this PR needs the export.
  • nit: src/review/secrets-scan.ts:155 only joins the last literal from the previous added line with the first literal from the current line, so a split value across adjacent lines but not in those exact literal positions will still be missed; document that limitation or extend the bounded join to adjacent literal pairs.
  • nit: src/review/secrets-scan.ts:135 uses a private duplicate of the diff-header matcher; if review-enrichment changes its accepted header shape, this copy can drift, so add a shared fixture or test case that pins the expected `+++`/`---` behavior.
  • Move the opportunity-freshness and barrel-export changes out of this PR, or add a clear rationale tying them to the secret-leak gate work.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (no linked issue context).
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: 107 registered-repo PR(s), 5 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 107 PR(s), 0 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
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: 107 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Explain no-issue PR.
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
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

RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 3, 2026


Exercise empty-line section breaks, orphan + lines, removed-line join reset,
added/renamed header paths, generic cross-line assignment, and the
already-matched skip path so Codecov patch coverage meets 99%.

Co-authored-by: Cursor <cursoragent@cursor.com>
RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 3, 2026
…2824)

Only skip real unified-diff file headers before the first hunk; added lines
whose content begins with ++ (rendered +++…) must still trip the gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
@RealDiligent
RealDiligent force-pushed the fix/secret-scan-cross-line-split branch from e3544c7 to fed04a3 Compare July 3, 2026 22:16
RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 3, 2026


Exercise empty-line section breaks, orphan + lines, removed-line join reset,
added/renamed header paths, generic cross-line assignment, and the
already-matched skip path so Codecov patch coverage meets 99%.

Co-authored-by: Cursor <cursoragent@cursor.com>
RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 3, 2026
…2824)

Only skip real unified-diff file headers before the first hunk; added lines
whose content begins with ++ (rendered +++…) must still trip the gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 3, 2026
The unescaped slash in /dev/null terminated the regex literal and broke
typecheck/validate-code on PR JSONbored#2824.

Co-authored-by: Cursor <cursoragent@cursor.com>
@RealDiligent
RealDiligent force-pushed the fix/secret-scan-cross-line-split branch from fed04a3 to 762f763 Compare July 3, 2026 22:25
RealDiligent and others added 5 commits July 4, 2026 07:22
…red#2454)

Port review-enrichment cross-line literal join into the unconditional
secret_leak gate so credentials split across consecutive + lines cannot
evade per-line regex matching. Preserves hunk/context boundaries and
patch-less synthetic diffs from JSONbored#2821.

Co-authored-by: Cursor <cursoragent@cursor.com>


Exercise empty-line section breaks, orphan + lines, removed-line join reset,
added/renamed header paths, generic cross-line assignment, and the
already-matched skip path so Codecov patch coverage meets 99%.

Co-authored-by: Cursor <cursoragent@cursor.com>
…2824)

Only skip real unified-diff file headers before the first hunk; added lines
whose content begins with ++ (rendered +++…) must still trip the gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
The unescaped slash in /dev/null terminated the regex literal and broke
typecheck/validate-code on PR JSONbored#2824.

Co-authored-by: Cursor <cursoragent@cursor.com>
…Nbored#2824)

Reset generic_secret_assignment runs at the same diff boundaries as the
cross-line literal join instead of scanning the whole diff blob. Add
regression tests for context, removed, hunk, and file-section splits.

Co-authored-by: Cursor <cursoragent@cursor.com>
@RealDiligent
RealDiligent force-pushed the fix/secret-scan-cross-line-split branch from 762f763 to a264ba5 Compare July 3, 2026 23:26
…2824)

Main dropped the export opener in packages/gittensory-engine/src/index.ts
(JSONbored#2787), breaking tsc for every backend PR including this one.

Co-authored-by: Cursor <cursoragent@cursor.com>
…red#2824)

Main opportunity-freshness returned age 0 for null/invalid timestamps, which scored as fully fresh and broke four validate-code tests. Align with upstream fix/opportunity-freshness-clock-drift by using a 9999-day sentinel so unparseable timestamps clamp to the 0.05 stale floor.

Co-authored-by: Cursor <cursoragent@cursor.com>

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge conflicts, fix + resubmit:

This branch has conflicts that must be resolved
Use the [web editor](https://github.com/JSONbored/gittensory/pull/2824/conflicts) or the command line to resolve conflicts before continuing.

packages/gittensory-engine/src/opportunity-freshness.ts

@JSONbored JSONbored closed this Jul 4, 2026
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.

2 participants