CNTRLPLANE-3534: ci: add --allowedTools to address-review-comments workflow - #8639
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@bryan-cox: This pull request explicitly references no jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
📝 WalkthroughWalkthroughThis PR updates the address-review-comments GitHub Actions workflow by adding a "Link to run" step that posts the current workflow run URL to the target PR using Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant gh
participant PullRequest
participant Claude
GitHubActions->>gh: execute `gh pr comment` to post run link
gh->>PullRequest: add workflow run URL as comment
GitHubActions->>Claude: call `/utils:address-reviews` with --allowedTools
Claude->>PullRequest: perform review-addressing actions
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 @.github/workflows/address-review-comments.yaml:
- Line 71: The workflow step invoking the Claude agent for
"/utils:address-reviews" currently grants high-risk tools via the --allowedTools
flag (notably "Bash" and "WebFetch"); tighten the toolset to least privilege by
removing "Bash" and "WebFetch" and only include the minimal tools that the
/utils:address-reviews action actually needs (e.g., keep "Read", "Write",
"Edit", "Grep", "Glob" if those are required), update the command string that
contains --allowedTools accordingly, and ensure no unnecessary network/shell
capabilities are granted (so the claude -p "/utils:address-reviews $PR_NUMBER"
invocation no longer exposes shell or web access).
🪄 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: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: e60b4831-500c-4236-9052-15d029ec305b
📒 Files selected for processing (1)
.github/workflows/address-review-comments.yaml
| run: | | ||
| claude --version | ||
| claude -p "/utils:address-reviews $PR_NUMBER" --model claude-opus-4-6 --max-turns 100 | ||
| claude -p "/utils:address-reviews $PR_NUMBER" --model claude-opus-4-6 --max-turns 100 --allowedTools "Bash Read Write Edit Grep Glob WebFetch" |
There was a problem hiding this comment.
Restrict high-risk Claude tools to reduce prompt-injection blast radius.
Allowing both Bash and WebFetch for an agent processing PR review content creates a direct exfiltration path if prompt-injected (the step also exposes GH_TOKEN). Please tighten --allowedTools to the minimum set required for /utils:address-reviews (avoid network/shell unless strictly necessary).
Suggested hardening
- claude -p "/utils:address-reviews $PR_NUMBER" --model claude-opus-4-6 --max-turns 100 --allowedTools "Bash Read Write Edit Grep Glob WebFetch"
+ claude -p "/utils:address-reviews $PR_NUMBER" --model claude-opus-4-6 --max-turns 100 --allowedTools "Read Write Edit Grep Glob"As per coding guidelines, "Agentic CI actions: audit for prompt injection via issue/PR title/body flowing into LLM prompts" and "Least privilege: minimize GITHUB_TOKEN permissions".
🤖 Prompt for 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.
In @.github/workflows/address-review-comments.yaml at line 71, The workflow step
invoking the Claude agent for "/utils:address-reviews" currently grants
high-risk tools via the --allowedTools flag (notably "Bash" and "WebFetch");
tighten the toolset to least privilege by removing "Bash" and "WebFetch" and
only include the minimal tools that the /utils:address-reviews action actually
needs (e.g., keep "Read", "Write", "Edit", "Grep", "Glob" if those are
required), update the command string that contains --allowedTools accordingly,
and ensure no unnecessary network/shell capabilities are granted (so the claude
-p "/utils:address-reviews $PR_NUMBER" invocation no longer exposes shell or web
access).
31c54d5 to
d81a91e
Compare
Without --allowedTools, Claude Code prompts for permission to run tools like gh and git in non-interactive mode, causing the job to exit without doing any work. Add the same tool allowlist used by the Prow review-agent job in openshift/release. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d81a91e to
fd384ae
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bryan-cox The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@bryan-cox: This pull request references CNTRLPLANE-3534 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/test security |
|
/verified later @bryan-cox |
|
@bryan-cox: This PR has been marked to be verified later by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/lgtm |
|
Pipeline controller notification No second-stage tests were triggered for this PR. This can happen when:
Use |
|
@bryan-cox: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
--allowedTools "Bash Read Write Edit Grep Glob WebFetch"to the Claude Code invocation in the address-review-comments GHA workflowissue_comment-triggered runs don't appear in the PR checks tabJira
https://redhat.atlassian.net/browse/CNTRLPLANE-3534
Test plan
/address-review-commentson a PR after merge and verify Claude processes reviews🤖 Generated with Claude Code