Skip to content

CNTRLPLANE-3534: ci: add --allowedTools to address-review-comments workflow - #8639

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:fix-address-review-allowed-tools
May 29, 2026
Merged

CNTRLPLANE-3534: ci: add --allowedTools to address-review-comments workflow#8639
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:fix-address-review-allowed-tools

Conversation

@bryan-cox

@bryan-cox bryan-cox commented May 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Add --allowedTools "Bash Read Write Edit Grep Glob WebFetch" to the Claude Code invocation in the address-review-comments GHA workflow
  • Without this flag, Claude prompts for tool permissions in non-interactive mode and exits without doing any work (failed run)
  • Matches the same allowlist used by the Prow review-agent job in openshift/release
  • Add a "Link to run" step that posts a comment on the PR with a direct link to the workflow run, since issue_comment-triggered runs don't appear in the PR checks tab

Jira

https://redhat.atlassian.net/browse/CNTRLPLANE-3534

Test plan

  • Trigger /address-review-comments on a PR after merge and verify Claude processes reviews

🤖 Generated with Claude Code

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 29, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This pull request explicitly references no jira issue.

Details

In response to this:

Summary

  • Add --allowedTools "Bash Read Write Edit Grep Glob WebFetch" to the Claude Code invocation in the address-review-comments GHA workflow
  • Without this flag, Claude prompts for tool permissions in non-interactive mode and exits without doing any work (failed run)
  • Matches the same allowlist used by the Prow review-agent job in openshift/release

Test plan

  • Trigger /address-review-comments on a PR after merge and verify Claude processes reviews

🤖 Generated with Claude Code

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.

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This 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 gh pr comment, and by changing the claude invocation to include an explicit --allowedTools allowlist ("Bash Read Write Edit Grep Glob WebFetch").

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
Loading

Possibly related PRs

  • openshift/hypershift#8621: Sets up the address-reviews command and workflow configuration that this PR further configures by adding explicit tool restrictions.

Suggested reviewers

  • sdminonne
  • Nirshal
🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR modifies a GitHub Actions workflow file, not test code. Contains no Ginkgo test definitions (It(), Describe(), etc.) to assess for dynamic test names.
Test Structure And Quality ✅ Passed PR modifies only .github/workflows/address-review-comments.yaml, a GitHub Actions workflow file with no Ginkgo test code changes. Test structure check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only GitHub Actions workflow file, not deployment manifests or operator code. No scheduling constraints introduced, so topology-aware check not applicable.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR modifies GitHub Actions workflow config only (.github/workflows/address-review-comments.yaml); no Ginkgo e2e tests are added, so IPv6/disconnected network compatibility check does not apply.
No-Weak-Crypto ✅ Passed The PR adds a GitHub Actions workflow file with no weak cryptography usage: no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB algorithms, custom crypto, or insecure secret comparisons detected.
Container-Privileges ✅ Passed PR only modifies GitHub Actions workflow file, not K8s/container manifests. Custom check targets container privilege configurations that are not present in this change.
No-Sensitive-Data-In-Logs ✅ Passed Workflow uses secure practices: curl with -s flag silences token output, gh CLI masks tokens in logs, outputs contain only non-sensitive data (branch, repo), and environment variables are not logged.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding the --allowedTools flag to the address-review-comments workflow to restrict available tools for Claude Code execution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
openshift-ci Bot requested review from Nirshal and sdminonne May 29, 2026 16:33
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 29, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9f16502 and 31c54d5.

📒 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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

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

@bryan-cox
bryan-cox force-pushed the fix-address-review-allowed-tools branch from 31c54d5 to d81a91e Compare May 29, 2026 16:40
@openshift-ci openshift-ci Bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. area/api Indicates the PR includes changes for the API area/ci-tooling Indicates the PR includes changes for CI or tooling area/cli Indicates the PR includes changes for CLI area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/documentation Indicates the PR includes changes for documentation area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/karpenter-operator Indicates the PR includes changes related to the Karpenter operator area/platform/azure PR/issue for Azure (AzurePlatform) platform and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/needs-area labels May 29, 2026
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>
@bryan-cox
bryan-cox force-pushed the fix-address-review-allowed-tools branch from d81a91e to fd384ae Compare May 29, 2026 16:43
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 29, 2026
@openshift-ci

openshift-ci Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 29, 2026
@bryan-cox bryan-cox changed the title NO-JIRA: ci: add --allowedTools to address-review-comments workflow CNTRLPLANE-3534: ci: add --allowedTools to address-review-comments workflow May 29, 2026
@openshift-ci-robot

openshift-ci-robot commented May 29, 2026

Copy link
Copy Markdown

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

Details

In response to this:

Summary

  • Add --allowedTools "Bash Read Write Edit Grep Glob WebFetch" to the Claude Code invocation in the address-review-comments GHA workflow
  • Without this flag, Claude prompts for tool permissions in non-interactive mode and exits without doing any work (failed run)
  • Matches the same allowlist used by the Prow review-agent job in openshift/release
  • Add a "Link to run" step that posts a comment on the PR with a direct link to the workflow run, since issue_comment-triggered runs don't appear in the PR checks tab

Jira

https://redhat.atlassian.net/browse/CNTRLPLANE-3534

Test plan

  • Trigger /address-review-comments on a PR after merge and verify Claude processes reviews

🤖 Generated with Claude Code

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.

@bryan-cox

Copy link
Copy Markdown
Member Author

/test security

@bryan-cox

Copy link
Copy Markdown
Member Author

/verified later @bryan-cox

@openshift-ci-robot openshift-ci-robot added verified-later verified Signifies that the PR passed pre-merge verification criteria labels May 29, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This PR has been marked to be verified later by @bryan-cox.

Details

In response to this:

/verified later @bryan-cox

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.

@csrwng

csrwng commented May 29, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 29, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification

No second-stage tests were triggered for this PR.

This can happen when:

  • The changed files don't match any pipeline_run_if_changed patterns
  • All files match pipeline_skip_if_only_changed patterns
  • No pipeline-controlled jobs are defined for the main branch

Use /test ? to see all available tests.

@openshift-ci

openshift-ci Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 411aef8 into openshift:main May 29, 2026
19 checks passed
@bryan-cox
bryan-cox deleted the fix-address-review-allowed-tools branch May 30, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/api Indicates the PR includes changes for the API area/ci-tooling Indicates the PR includes changes for CI or tooling area/cli Indicates the PR includes changes for CLI area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/documentation Indicates the PR includes changes for documentation area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/karpenter-operator Indicates the PR includes changes related to the Karpenter operator area/platform/azure PR/issue for Azure (AzurePlatform) platform jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria verified-later

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants