Skip to content

Seb/codex reviewer#143

Closed
sebzhao wants to merge 2 commits into
mainfrom
seb/codex-reviewer
Closed

Seb/codex reviewer#143
sebzhao wants to merge 2 commits into
mainfrom
seb/codex-reviewer

Conversation

@sebzhao
Copy link
Copy Markdown
Contributor

@sebzhao sebzhao commented Jun 5, 2026

Adds codex reviewer for narada-python-sdk

Comment on lines +133 to +139
- name: Check out pull request merge ref
uses: actions/checkout@v6
with:
ref: refs/pull/${{ steps.prepare.outputs.pr_number }}/merge
fetch-depth: 0

- name: Load architecture docs
Comment on lines +184 to +190
- name: Pre-fetch base and head refs
run: |
git fetch --no-tags origin \
"${{ steps.prepare.outputs.base_ref }}:refs/remotes/origin/${{ steps.prepare.outputs.base_ref }}" \
"+refs/pull/${{ steps.prepare.outputs.pr_number }}/head:refs/remotes/pull/${{ steps.prepare.outputs.pr_number }}/head"

- name: Create runtime Codex prompt
Copy link
Copy Markdown

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

Found 4 material issues:

  1. .github/workflows/codex-review.yaml:182/:329 execute JavaScript from the checked-out PR after refs/pull/.../merge is checked out. On the manual @review path, that gives the PR a way to run repository-credentialed code by modifying scripts/ci/*.mjs.
  2. .github/workflows/codex-review.yaml:201 and :320 load the review prompt/schema from the PR checkout itself. That makes the reviewer self-modifiable: a PR can rewrite Codex's instructions or output contract and force a false lgtm.
  3. .github/workflows/codex-review.yaml:24 only excludes bots before honoring @review. Any account that can comment on the PR can repeatedly trigger a paid gpt-5.4 / xhigh run.
  4. .github/workflows/codex-review.yaml:312 assumes OPENAI_API_KEY is available on every pull_request run. This repo already special-cases missing secrets for fork/Dependabot PRs in .github/workflows/architecture-docs-freshness.yml; without the same guard here, those PRs have no successful automatic review path.

Codex Reference Context

  • NaradaAI/api-docs: not loaded (default-main; gh: Not Found (HTTP 404))
  • NaradaAI/caddie: not loaded (default-main; gh: Not Found (HTTP 404))
  • NaradaAI/desktop-automation-app: not loaded (default-main; gh: Not Found (HTTP 404))
  • NaradaAI/frontend: not loaded (default-main; gh: Not Found (HTTP 404))

Automated review by Codex via GitHub Actions.

(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
(github.event.comment.user.type || '') != 'Bot' &&
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This only filters bots. There is no collaborator/permission check, so any account that can comment on the PR can retrigger a paid Codex run with @review. If the manual trigger is meant to be maintainer-only, gate it on author_association or a repo-permission lookup.

REVIEW_CONTEXT_FILE: ${{ steps.prepare.outputs.context_file }}
DEFAULT_REFERENCE_REPOS: caddie frontend api-docs desktop-automation-app
run: |
node ./scripts/ci/load-codex-reference-repos.mjs
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

By this point the job has checked out refs/pull/.../merge, so this is executing PR-authored JS with GH_TOKEN in its environment (same problem later for post-codex-review.mjs with GITHUB_TOKEN). A malicious PR can replace these scripts and exfiltrate repo credentials when @review is used; the privileged path needs code pinned from the default branch or a fork skip.

const fs = require('node:fs');
const path = require('node:path');

const template = fs.readFileSync('.github/codex/prompts/pr-review.md', 'utf8').trim();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This makes the reviewer self-modifiable: the PR can change .github/codex/prompts/pr-review.md here (and the schema passed on line 320) to force lgtm or suppress findings. If the review is supposed to be trustworthy, load these assets from the default branch or a pinned action artifact instead of the merge ref.

- name: Run Codex review
uses: openai/codex-action@v1
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This unconditionally requires OPENAI_API_KEY, but the repo already treats fork/Dependabot pull_request runs as missing normal secrets in architecture-docs-freshness.yml. Without the same guard here, those PRs cannot complete the automatic review path and will needlessly fail the workflow.

@sebzhao sebzhao closed this Jun 5, 2026
@sebzhao sebzhao deleted the seb/codex-reviewer branch June 5, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants