ci: add Claude security-review workflow for sensitive-path PRs#35715
ci: add Claude security-review workflow for sensitive-path PRs#35715mbiuki wants to merge 4 commits into
Conversation
Runs an AI-assisted /security-review on every PR that touches a security-sensitive path. Posts an abstract comment on the public PR, notifies the author privately on Slack with full findings, and fails the check so the PR can be marked required-for-merge in branch protection rules. Requires the following to be configured before this workflow is useful (see file header): secrets: ANTHROPIC_API_KEY, SLACK_BOT_TOKEN, SLACK_USER_MAP vars: SLACK_SECURITY_CHANNEL
❌ Issue Linking RequiredThis PR could not be linked to an issue. All PRs must be linked to an issue for tracking purposes. How to fix this:Option 1: Add keyword to PR body (Recommended - auto-removes this comment)
Why is this required?Issue linking ensures proper tracking, documentation, and helps maintain project history. It connects your code changes to the problem they solve.--- This comment was automatically generated by the issue linking workflow |
|
Claude finished @mbiuki's task in 2m 7s —— View job PR Review
Things I'd flag before this lands1. AI-review step failures silently fail OPEN, not safe. 2. Prompt-injection blast radius via 3. "DM'd on Slack" is misleading — this is a channel post. The PR description and the comment at line 220 both say the author is "DM'd". 4. Reviewer feedback not addressed. sfreudenthaler explicitly asked: "the prompt should be moved to a standalone markdown file". The inline prompt (lines 154-178) is still inline. If you disagree, push back; if you agree, do it before requesting re-review. 5. Semgrep precheck is fairly easy to spoof. 6. 7. Disclosure leak via finding count. Line 216 posts "N issue(s)" publicly. Knowing "this PR has 3 security issues" is itself information — a watcher can deduce when a fix lands by waiting for the count to drop to 0, or guess at severity from medium/high split (which is in the JSON but not posted, good). For a public repo, even the number is a hint. Trivially fixable: drop the number and post "issues were found" instead. 8. Slack 9. Comment spam on each push. Already in the known-limitations list, but worth a follow-up issue with a specific implementation note: use 10. No artifact / audit trail. 11. PR title is interpolated into Slack message text unsanitized (line 295). Not a security issue (Slack mrkdwn doesn't execute), but a PR title containing 12. Clean parts: path filter is reasonable (and the SI-75 framing is right), The biggest things to fix before merging are #1 (fail-open on errors) and #3 (Slack channel vs DM wording), plus addressing sfreudenthaler's standalone-prompt request from his existing change-request review. |
sfreudenthaler
left a comment
There was a problem hiding this comment.
if we go this route the prompt should be moved to a standalone markdown file. makes it easier to review and understand the code
Adds a precheck step that scans for any prior Semgrep activity on the PR — check runs, issue comments, PR reviews, or inline review comments authored by anything matching /semgrep/i. When found, the Claude review is skipped, a short "skipped" comment is posted, and the check passes (trusting Semgrep's coverage). When absent, the Claude review proceeds as before.
Status updateDone
To do (before this is live)Configuration
Validation
Rollout
Known limitations to revisit
|
Tracks #35714.
Summary
Adds
.github/workflows/claude-security-review.ymlwhich runs an AI-assisted security review on every PR touching a security-sensitive path. Designed to address the gap exposed by recent incidents (SI-75) where unauthenticated SQL injection landed via human review.Behavior
pull_request(opened / synchronize / reopened / ready_for_review), filtered to security-sensitive paths only — REST resources, auth/login, servlets/filters, business impls (DB layer), push-publish, OSGi, web app, SQL, build files, Dockerfiles, workflows.Required configuration before this is useful
The workflow no-ops until these are configured (see header in the YAML for details):
Secrets (Settings → Secrets and variables → Actions → Secrets):
Variables (Settings → Secrets and variables → Actions → Variables):
Branch protection (Settings → Branches → main):
Known limitations
Test plan
🤖 Generated with Claude Code