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
1 change: 1 addition & 0 deletions .github/workflows/codex-pr-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
sandbox: read-only
safety-strategy: drop-sudo
prompt-file: .github/prompts/codex-pr-review.md
allow-users: "*"

Choose a reason for hiding this comment

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

Action required

1. Wildcard allow-users on prs 🐞 Bug ⛨ Security

allow-users: "*" broadens who can run the Codex action in a pull_request_target workflow that
has write permissions and uses OPENAI_API_KEY. This increases exposure to cost/resource abuse
(anyone can open PRs) and increases risk if the action is ever compromised, since it runs with
elevated repo permissions.
Agent Prompt
### Issue description
`allow-users: "*"` opens the Codex PR review action to all PR authors in a `pull_request_target` workflow that has write permissions and consumes `OPENAI_API_KEY`. This expands the set of untrusted users who can trigger an expensive privileged workflow.

### Issue Context
- Workflow runs on `pull_request_target` and is designed to comment on fork PRs.
- Other workflows in this repo use `author_association` checks to limit AI automation to trusted users.

### Fix Focus Areas
- .github/workflows/codex-pr-review.yml[3-18]
- .github/workflows/codex-pr-review.yml[48-66]

### Suggested changes
1) Add a job-level `if:` guard restricting execution to trusted associations, e.g.:
```yaml
if: |
  github.event.pull_request.draft == false &&
  (github.event.pull_request.author_association == 'OWNER' ||
   github.event.pull_request.author_association == 'MEMBER' ||
   github.event.pull_request.author_association == 'COLLABORATOR' ||
   github.event.pull_request.author_association == 'CONTRIBUTOR')
```
2) Replace `allow-users: "*"` with a narrower allowlist (specific users/teams) or remove it to retain the action’s default gating behavior.

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


- name: Validate Codex output
shell: bash
Expand Down
Loading