Report source lines in security preflight findings - #311
Conversation
WalkthroughThe security preflight now tracks Git diff file names and new-file line numbers. It parses unified diff hunks, reports source-aware suspicious locations, and falls back to diff output lines for malformed headers. Tests cover multi-hunk and fallback cases. ChangesSuspicious diff location tracking
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/pr-batch/bin/pr-security-preflight`:
- Line 730: Update the added_line detection in the diff scanner to treat every
remaining line beginning with “+” as an addition, relying on the existing
file-header handling at lines 718-722 to exclude “+++ ” headers. Add a
regression fixture covering suspicious content whose added payload begins with
“++”.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bfb4a198-d2a4-49ba-83ff-da2f83c0dc9c
📒 Files selected for processing (2)
skills/pr-batch/bin/pr-security-preflightskills/pr-batch/bin/pr-security-preflight-test.rb
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fdf4ec159
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ReviewOverviewThis PR improves CorrectnessI traced the new state machine in
I did not find any correctness bugs. The detection predicate itself ( SecurityNo regressions. The location-string changes are cosmetic/diagnostic only; the actual blocking/warning decision logic is untouched. No raw diff content is echoed for malformed input, matching the PR's stated goal. Minor observations (non-blocking)
Test coverageThe two new tests ( Overall: solid, well-tested, low-risk diagnostic improvement. No blocking issues found. |
ReviewOverviewThis PR improves CorrectnessI hand-traced the parser against all four fixtures (single-hunk, multi-hunk, malformed-hunk, and the Key points verified:
Minor notes (left inline)
SecurityNo concerns — the change only affects where a finding is reported, not whether one is raised, and (per the point above) actually closes a detection gap rather than opening one. Suspicious raw content is still never printed, only location metadata, consistent with the existing security posture. PerformanceSingle pass over Test coverageGood — new tests cover multi-hunk tracking and malformed hunk header fallback, and the fake Overall: solid, well-tested change with an incidental security fix. No blocking issues. |
|
Review Overview Code quality / correctness
Minor issues (left as inline comments)
Test coverage Security Overall: solid, well-tested change with only cosmetic nits. |
Address-review summaryScan scope: full PR history; no prior valid address-review summary cutoff. Mattered
Optional
Skipped
Deferred-work tracking: none; all optional outcomes were explicitly declined with rationale and their conversations were resolved. Next default scan starts after this comment. Say |
…gned-launch-readiness * origin/main: Report source lines in security preflight findings (#311)
…-policy * origin/main: Report source lines in security preflight findings (#311)
…/pr291-redesign-implementation * commit '6239fd0afa5bb7d87cd3fb09cc22ae30bcf1e369': Fix locale-dependent test, surface policy-only CLAUDE.md follow-ups, add read-only seam-drift audit (#337) Add PR #377 changelog entry (#382) Make PR descriptions human-first (#377) Remove unsupported signed-launch enforcement (#374) Emit coordination telemetry and provenance at workflow checkpoints (#290) Add explicit multi-language lint CI (#313) Reconcile later-completed audit targets (#315) Report source lines in security preflight findings (#311) Gate completed-batch publication on terminal scope and QA (#308) Add guarded merge submission seam (#304) Fix exact-head readiness when status rows omit SHA (#307) fix: allow YAML timestamps in action scanner (#305) Pin workflow dependencies and define release trust boundary (#295) Support direct merges without merge queues (#297)
Summary
++renders as+++and could be mistaken for a file header; file headers are now recognized only during the pre-hunk metadata phase++added payloads (including after a--deleted payload), and raw-content redactionValidation
git diff --check, and focused RuboCop — clean; 2 files inspected, no offensesbin/validate— passed; RuboCop inspected 112 files with no offensesbin/validateagainst currentmain— passed; RuboCop inspected 114 files with no offensesvalidateandclaude-review— completed successfully at3ced9f8a11010f400c6ec34d0935420021098fb8Summary by CodeRabbit
Bug Fixes
Tests