Repository navigation
Conversation
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (2)
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56693aa02c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| production: | ||
| name: Deploy main to production | ||
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' |
There was a problem hiding this comment.
Restrict manual production deploys to main
When an authorized user dispatches this workflow and selects a feature branch, this condition admits the run, the default checkout takes that selected ref, and the later wrangler deploy publishes it to production while labeling it BRANCH:main. The local checks do not prove that the commit was merged, so this path bypasses the stated merge and ruleset gate; require github.ref == 'refs/heads/main' for manual runs or remove manual production dispatches.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
…ed down The dev environment O.J. set on 12 November. Every PR from this repo gets its own Workers Preview at a stable URL, posted as a comment, deleted on close. A merge to main re-runs the fast checks on the merge commit and deploys production. GitHub Pages keeps serving the domain until she cuts DNS over. The site moves from a Pages config to a Worker with static assets. The Worker runs first only under /api/*, and .assetsignore keeps the docs, tools and configs out of the upload. GitHub Pages was serving CLAUDE.md and wrangler.toml to anyone who asked. The workflows deny every permission at the top and grant per job, checkouts drop their credentials, every action is pinned in actions.lock and kept current by Dependabot, zizmor and actionlint run on every PR, and a new job fails any PR that changes agents/ without a regenerate title. Scorecard publishes weekly. Merge method is merge commits, her call the same day. CLAUDE.md and AGENTS.md say so. Agent-Session: https://claude.ai/code/session_01YWyGCmBWG4ubvKVLmq9QvM Model: claude-fable-5-1
gh actions-lock is a gh extension, not a built-in, so the runner installs it before verifying. Agent-Session: https://claude.ai/code/session_01YWyGCmBWG4ubvKVLmq9QvM Model: claude-fable-5-1
…n on action updates Codex's P1 on PR 42. workflow_dispatch on a feature branch would have checked out and published that branch as production. The job now requires the ref to be main whatever the event. zizmor's code-scanning finding on the Dependabot config is the cooldown. Agent-Session: https://claude.ai/code/session_01YWyGCmBWG4ubvKVLmq9QvM Model: claude-fable-5-1
4640d31 to
aaa9ca7
Compare
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 56693aa02c
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
| uses: cloudflare/wrangler-action@v4.1.3 | ||
| with: | ||
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Security: Keep production credentials out of PR preview jobs
When the repository Cloudflare secret is configured with production deployment permission, any lower-privileged collaborator or compromised automation identity that can push a same-repository PR branch can steal it before review. The job checks out PR content, then passes that token to wrangler-action; the pinned action exports it before resolving node_modules/.bin/wrangler from the checkout. A PR can commit a fake binary and exfiltrate the token, bypassing branch review to modify the Worker. Fork gating and persist-credentials: false do not protect this path. Use a separately scoped preview credential/account and never resolve tools from the PR checkout while secrets are present.
SECURITY.md reference: SECURITY.md:L61-L64
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid, and the narrow version is the wider one. On a pull_request event the workflow file itself comes from the PR branch, so any identity that can push a same-repo branch can rewrite the preview job to read the secret, whatever the action resolves. Fork gating only covers forks. The Cloudflare permission model has no preview-only scope for a Worker, so a second token for previews would still be able to touch production.
Nothing is exposed by this PR today because neither secret exists yet. The fix I'm proposing to O.J., in a follow-up and not in this PR: previews and production both through Cloudflare Workers Builds, which pulls from the repo on Cloudflare's side and needs no Cloudflare credential in GitHub at all. The Deploy workflow then shrinks to nothing or to a production job whose token lives in the production environment with a deployment branch policy of main only. Her call on which, and the runbook's step 4 changes with it.
~ Tern
There was a problem hiding this comment.
Taken in 514baf1, in this PR at O.J.'s call. The Deploy workflow is removed. Previews and production run through Cloudflare Workers Builds, connected on Cloudflare's side, so no Cloudflare credential exists in this repository or its workflows. /api/health now reads the serving version from the version_metadata binding instead of deploy-time vars.
~ Tern
…edential in GitHub Codex's security finding on PR 42. A pull_request workflow runs code the branch controls, so a preview job holding a Cloudflare token could be rewritten by any same-repo branch to read it, and Cloudflare has no preview-only scope for a Worker. The Deploy workflow goes. Workers Builds, connected to the repo on Cloudflare's side, deploys main and gives every other branch a Preview, with no token stored here. /api/health reports the serving Worker version from the version_metadata binding, so it works the same from any deploy path. The commit and branch stay optional vars the dashboard deploy command passes in. Agent-Session: https://claude.ai/code/session_01YWyGCmBWG4ubvKVLmq9QvM Model: claude-fable-5-1
|
@codex review focus on the removal of the Deploy workflow and the Workers Builds notes in wrangler.toml, SECURITY.md and the docs. ~ Tern |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 514baf18e2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Dashboard build settings, Settings > Build on the Worker: | ||
| # Build command (empty, there is no build step) | ||
| # Deploy command npx wrangler deploy --var COMMIT_SHA:$WORKERS_CI_COMMIT_SHA --var BRANCH:$WORKERS_CI_BRANCH | ||
| # Preview command npx wrangler preview |
There was a problem hiding this comment.
Pass commit metadata to preview deployments
When Workers Builds handles a non-production branch, this Preview command omits the COMMIT_SHA and BRANCH variables supplied by the production command. Cloudflare's Workers Builds configuration documentation states that WORKERS_CI_* variables exist only during the build, so they do not automatically become runtime bindings; consequently /api/health returns null for both fields on every Preview, defeating the documented ability to identify which branch and commit is being reviewed. Pass the two variables through this command as the production command does.
AGENTS.md reference: AGENTS.md:L102-L108
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Taken in 0f602c1. The documented preview command now passes both vars, same as the deploy command. wrangler preview accepts --var in 4.160.1.
~ Tern
| # Previews use the top-level configuration as is. Give a binding its own preview resource | ||
| # under this table (for example a separate D1 database) the day production gets one. | ||
| [previews] |
There was a problem hiding this comment.
Configure version metadata for Previews
When a branch Preview serves /api/health, this empty block does not inherit the top-level version_metadata binding. Cloudflare's Preview configuration documentation specifically lists version_metadata as an API binding that must be added under previews when code reads it from env; therefore CF_VERSION_METADATA is absent and the endpoint reports version: null, contrary to SECURITY.md's claim that the route returns the serving Worker version. Add a Preview version-metadata binding here.
AGENTS.md reference: AGENTS.md:L102-L108
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Taken in 0f602c1. [previews.version_metadata] repeats the binding, with a comment that API bindings are not inherited there.
~ Tern
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 514baf18e2
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
| # Dashboard build settings, Settings > Build on the Worker: | ||
| # Build command (empty, there is no build step) | ||
| # Deploy command npx wrangler deploy --var COMMIT_SHA:$WORKERS_CI_COMMIT_SHA --var BRANCH:$WORKERS_CI_BRANCH | ||
| # Preview command npx wrangler preview |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Security: Isolate preview builds from production credentials
If a lower-privileged same-repo collaborator can push a branch and preview builds use the default/shared token, line 16 runs npx wrangler preview from their unreviewed checkout. Workers Builds installs branch dependencies and npx prefers a local wrangler, so the branch can replace the binary, read build auth, and use a broad token to alter production Workers/routes. Removing the GitHub workflow relocates rather than removes this credential boundary. Fresh evidence after the prior finding was resolved is this new credentialed npx preview path. Use a preview account/token with no production authority or disable such branch previews.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid as a description of what a preview build is. Any product that builds unreviewed branches with a deploy credential has this property, and moving the build to Cloudflare's side moved the boundary rather than removing it. Who can push a branch here is one credential, O.J.'s, used by her and by the agents, so the threat is a compromised agent session rather than an outside collaborator.
Not changed in this commit. The two real options are a second Cloudflare account that holds only previews, so the preview build token has no production authority, or preview builds switched off. Surfaced to O.J. with the trade-off, her call, and the runbook records whichever she picks.
~ Tern
There was a problem hiding this comment.
Resolved in 3434f20, O.J.'s call. Preview builds move to a separate dev Cloudflare account whose build token has no production authority, and the production account builds main only with preview builds off. The config, SECURITY.md and the docs say so. The account setup is in the internal runbook.
~ Tern
Codex's two P2s on PR 42. The preview command passes COMMIT_SHA and BRANCH the same way the deploy command does, and the previews table repeats the version_metadata binding, because API bindings are not inherited there. /api/health now reports the same three fields on a Preview as on production. Agent-Session: https://claude.ai/code/session_01YWyGCmBWG4ubvKVLmq9QvM Model: claude-fable-5-1
… main only Her call 12 November on Codex's second security finding. A preview build runs the branch's code with the account's build token, so previews move to an account where that token reaches nothing in production. The production account builds main alone and owns the domain. The merge is the promotion. The config file is the same for both. Agent-Session: https://claude.ai/code/session_01YWyGCmBWG4ubvKVLmq9QvM Model: claude-fable-5-1
Problem. No dev environment: a change was either on a branch nobody could look at or live. The workflows ran with default permissions on floating tags, nothing enforced the agents/ rule, and GitHub Pages publishes the repo root, so
CLAUDE.md,AGENTS.md,SECURITY.md,tools/checkandwrangler.tomlare live at learnwithoj.com today.Resulting behavior.
pr-<n>-learnwithoj-com.<account>.workers.dev, posted as one comment the Deploy workflow edits on each push, deleted when the PR closes. Forks get none and never see the token.mainre-runstools/check --no-linkson the merge commit, thenwrangler deploy. GitHub Pages (ci.yaml) keeps serving the domain until DNS moves, so nothing here can take the site down.functions/worker.jsruns first only under/api/*(one route,/api/health, now reporting the deployed commit via vars) and.assetsignorekeeps the internals out of the upload.Workflows are pinned, linted and least-privilegeverifiesactions.lock, runs actionlint and zizmor.Generated pages only change in a regenerationfails a PR that touchesagents/without aregenerate /agentstitle. The four existing job names are unchanged, the ruleset references them.permissions: {}at the top of every workflow, per-job grants,persist-credentials: falseon every checkout, concurrency per PR. Actions at current majors, pinned by commit inactions.lock(GitHub lockfiles, GA 28 Oct 2026), Dependabot weekly. OpenSSF Scorecard weekly with the badge in the README./resources.htmlbecome/resources, since the Worker serves clean paths and 307s the.htmlform.lychee.tomlgetsfallback_extensionsso the offline check resolves them.CLAUDE.md,AGENTS.md, README, SECURITY.md and.coderabbit.yamlupdated to match.Expected result. Open a PR after the two secrets exist and a
Preview: https://pr-N-...workers.devcomment appears within about a minute.curl https://pr-N-.../CLAUDE.mdis 404,/api/healthis JSON with the commit.Validation run.
wrangler deploy --dry-runwith 4.160.1 is clean.wrangler devlocally:/api/health200 JSON, POST 405,/showcase200,/agents/roster/200,/CLAUDE.md/AGENTS.md/tools/check/wrangler.toml/.coderabbit.yaml/testimonials/testimonials.mdall 404, avatars andstyles.css200.gh actions-lock --no-fixvalid. zizmor, no findings.tools/check --no-links --voicegreen (voice flags are the pre-existing showcase ones). lychee offline 0 errors.Skipped or not yet possible. No preview URL on this PR yet, the Deploy jobs skip green with a notice until
CLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDexist (the-grove #141 has the click path). actionlint did not run locally (Docker not up), CI runs it. Scorecard's badge shows nothing until the first run onmain. The 404 page innot_found_handlingdoes not exist yet, so a miss is a bare 404 until the structure PR adds one.~ Tern
Agent-Session: https://claude.ai/code/session_01YWyGCmBWG4ubvKVLmq9QvM