Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pr-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# pr-agent (OSS) caller — adopts the wave-foundation reusable lane.
# Engine: OSS Qodo Merge on our OPENAI_KEY (trial-independent). SSOT pinned by SHA.
name: pr-agent (OSS)
on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize]
issue_comment:
types: [created]
Comment on lines +4 to +8

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Untrusted comment-triggered secret run 🐞 Bug ⛨ Security

The workflow runs on issue_comment and forwards OPENAI_KEY with write-capable permissions, but
has no guard restricting execution to PR comments and trusted actor associations. This creates a
risky privilege boundary where untrusted commenters can invoke a privileged reusable workflow run
with a sensitive secret available in its environment.
Agent Prompt
### Issue description
`.github/workflows/pr-agent.yml` triggers on `issue_comment` and passes `OPENAI_KEY` while granting write permissions. Without an explicit guard, any issue comment (including on non-PR issues) and potentially untrusted PR comment activity can invoke the privileged workflow run.

### Issue Context
This workflow is intended to act on PRs, but `issue_comment` is emitted for both Issues and PRs. The job should only run when the comment is on a PR **and** the commenter is trusted (e.g., MEMBER/OWNER/COLLABORATOR), or behind an explicit maintainer-only command pattern.

### Fix Focus Areas
- .github/workflows/pr-agent.yml[5-24]

### Suggested change
Add a job-level `if:` that:
1) ensures `issue_comment` is only accepted when `github.event.issue.pull_request` is present, and
2) restricts the actor association to trusted roles.

Example (adjust policy as desired):
```yaml
jobs:
  pr_agent:
    if: >-
      github.event_name == 'pull_request' ||
      (github.event_name == 'issue_comment' &&
       github.event.issue.pull_request &&
       contains(fromJson('["MEMBER","OWNER","COLLABORATOR"]'), github.event.comment.author_association))
    uses: ...
```
Optionally also restrict by comment content (e.g., only run when comment starts with `/pr-agent`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


permissions:
issues: write
pull-requests: write
contents: read

concurrency:
group: pr-agent-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
cancel-in-progress: true

jobs:
pr_agent:
uses: wave-av/wave-foundation/.github/workflows/reusable-pr-agent.yml@150ffae24f63e207ab81430fa64cb2b1e5c01546 # post-#1191
secrets:
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Loading