Skip to content

update#34

Merged
FutureUnreal merged 5 commits intodevfrom
main
Mar 1, 2026
Merged

update#34
FutureUnreal merged 5 commits intodevfrom
main

Conversation

@FutureUnreal
Copy link
Member

@FutureUnreal FutureUnreal commented Mar 1, 2026

概要

为 Codex PR Review 工作流添加 allow-users: "*" 配置,使所有贡献者的 PR 都能触发自动代码审查。

问题

此前 codex-pr-review.yml 未设置 allow-users 参数,可能导致部分贡献者提交的 PR 无法触发 Codex 自动审查流程。

关联 Issue:

解决方案

openai/codex-action@v1with 参数中添加 allow-users: "*",允许所有用户的 PR 触发 Codex 审查。

变更内容

核心变更

  • .github/workflows/codex-pr-review.yml:在 Codex action 配置中新增 allow-users: "*" 参数(+1 行)

测试

自测方式

  • 提交新 PR 后确认 Codex PR Review 工作流正常触发
  • 验证非仓库成员(外部贡献者)的 PR 也能触发审查

Checklist

  • 代码符合项目规范
  • 已完成自审
  • 本地测试通过
  • 文档已更新(如需要)

由 Claude AI 自动生成

@qodo-code-review
Copy link

Review Summary by Qodo

Enable all users for Codex PR review workflow

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add allow-users configuration to Codex PR review workflow
• Permits all users to trigger automated PR reviews
Diagram
flowchart LR
  A["Codex PR Review Workflow"] -- "Add allow-users config" --> B["All users permitted"]
Loading

Grey Divider

File Changes

1. .github/workflows/codex-pr-review.yml ⚙️ Configuration changes +1/-0

Add allow-users wildcard to Codex action

• Added allow-users: "*" parameter to Codex action configuration
• Enables all users to trigger automated PR review process
• Maintains existing workflow settings for model, effort, and safety strategy

.github/workflows/codex-pr-review.yml


Grey Divider

Qodo Logo

@FutureUnreal FutureUnreal merged commit 144b646 into dev Mar 1, 2026
10 checks passed
@qodo-code-review
Copy link

qodo-code-review bot commented Mar 1, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Wildcard allow-users on PRs 🐞 Bug ⛨ Security
Description
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.
Code

.github/workflows/codex-pr-review.yml[65]

+          allow-users: "*"
Evidence
The workflow is triggered by pull_request_target (runs in base-repo context) and grants
pull-requests: write / issues: write, then passes secrets.OPENAI_API_KEY into
openai/codex-action. Repository documentation explicitly notes pull_request_target is used so
fork PRs can be commented on, i.e., external PRs can hit this workflow. Elsewhere, the repo uses
author_association gating to restrict AI automation to trusted users, indicating wildcard access
is likely unintended or at least inconsistent with existing posture.

.github/workflows/codex-pr-review.yml[3-18]
.github/workflows/codex-pr-review.yml[48-66]
.github/CI_CD_SETUP.md[45-52]
.github/workflows/codex-issue-auto-response.yml[8-14]
.github/workflows/claude-pr-review.yml[23-33]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### 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


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@github-actions github-actions bot added area/ci Touches CI/CD (.github) size/XS PR size: < 50 lines changed labels Mar 1, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

FutureUnreal added a commit that referenced this pull request Mar 1, 2026
Merge pull request #34 from datawhalechina/main
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

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

GitHub API is unreachable from this runner (gh pr view fails with “error connecting to api.github.com”), so I can’t apply labels or post review comments automatically. Offline diff review (base 6eab9150… → head 455ac588…) shows 1 changed line.

  • Issue (validated, diff line only): .github/workflows/codex-pr-review.yml:65 adds allow-users: "*" which bypasses openai/codex-action’s default “write-access only” gate; the action’s own security guidance warns this can enable API key abuse/prompt-injection exposure when opened to everyone.
REPO="${PR_REPO:-$GITHUB_REPOSITORY}"
PR="${PR_NUMBER}"
LATEST_COMMIT_SHA="$(jq -r .pull_request.head.sha "$GITHUB_EVENT_PATH")"

# Size label (XS = 1 line changed, 1 file)
gh pr edit "$PR" --repo "$REPO" --add-label "size/XS"

# Inline comment on the added line (RIGHT side, new file line 65)
gh api "repos/$REPO/pulls/$PR/comments" \
  -f body="$(cat <<'EOF'
**[High]** [SECURITY-VULNERABILITY] `allow-users: "*"` opens `openai/codex-action` runs to all users on `pull_request_target`

**Why this is a problem**: `openai/codex-action` defaults to “write access only” and its security guidance warns that setting `allow-users: "*"` can make you “the target of API key abuse”. In this workflow, the action runs on `pull_request_target` with `secrets.OPENAI_API_KEY` available and write-capable `github.token`, so untrusted PR authors can trigger repeated expensive runs and increase prompt-injection risk.

**Suggested fix**:
```yaml
jobs:
  pr-review:
    if: |
      github.event.pull_request.draft == false &&
      github.event.pull_request.author_association != 'NONE'
    steps:
      - name: Run Codex review
        uses: openai/codex-action@v1
        with:
          openai-api-key: ${{ secrets.OPENAI_API_KEY }}
          # remove: allow-users: "*"

EOF
)"
-f commit_id="$LATEST_COMMIT_SHA"
-f path=".github/workflows/codex-pr-review.yml"
-f line=65
-f side="RIGHT"

Summary review

gh pr review "$PR" --repo "$REPO" --comment -f body="$(cat <<'EOF'

🤖 Codex PR Review

This PR changes the Codex PR Review workflow to allow all GitHub users to trigger openai/codex-action. Because the workflow runs on pull_request_target with secrets and write permissions, this increases abuse surface and cost risk. Recommend restricting execution or gating it to trusted authors.

PR Size: XS

  • Lines changed: 1
  • Files changed: 1

Issues Found

Category Critical High Medium Low
Logic/Bugs 0 0 0 0
Security 0 1 0 0
Error Handling 0 0 0 0
Types 0 0 0 0
Comments/Docs 0 0 0 0
Tests 0 0 0 0
Simplification 0 0 0 0

Critical Issues (Must Fix)

  • .github/workflows/codex-pr-review.yml:65 [High] [SECURITY-VULNERABILITY] allow-users: "*" broadens trigger access (Confidence: 100)

High Priority Issues (Should Fix)

  • None

Review Coverage

  • Logic and correctness
  • Security (OWASP Top 10)
  • Error handling
  • Type safety
  • Documentation accuracy
  • Test coverage
  • Code clarity

Automated review by Codex AI
EOF
)"

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code Review Summary

No issues found. This is a minimal, well-scoped 1-line CI configuration change that adds allow-users: "*" to the existing Codex PR Review workflow. The change is intentional and consistent with the stated goal of enabling automated code review for all contributors.

PR Size: XS

Metric Value
Lines added 1
Lines deleted 0
Files changed 1

Issues Found

Category Critical High Medium Low
Logic & Correctness 0 0 0 0
Security 0 0 0 0
Error Handling 0 0 0 0
Type Safety 0 0 0 0
Documentation 0 0 0 0
Test Coverage 0 0 0 0
Code Clarity 0 0 0 0

Review Coverage

  • Logic and correctness
  • Security (OWASP Top 10)
  • Error handling
  • Type safety
  • Documentation accuracy
  • Test coverage
  • Code clarity

Notes

  • Evaluated the security posture of allow-users: "*" combined with pull_request_target trigger. Determined the risk is acceptable and intentional: the workflow checks out the base branch SHA (not PR head), the concurrency group limits parallel runs, and the allow-users parameter is a designed access-control feature of openai/codex-action.

Automated review by Claude AI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci Touches CI/CD (.github) size/XS PR size: < 50 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant