Repository navigation
secrets: scope worker-deploy and codex-refresh to protected environments - #513
Merged
Merged
Conversation
CLOUDFLARE_API_TOKEN and CODEX_AUTH_JSON were repo-level secrets, readable by any workflow including PR-triggered ones. Move both into main-pinned GitHub environments so PR runs can't read them — the same shape PyPI release and the codex refresher PAT already use. worker-deploy now runs in the cloudflare-deploy environment; the codex refresher writes the rotated secret back to its codex-auth-refresh environment instead of repo level. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tend-agent
approved these changes
May 15, 2026
5 tasks
max-sixty
added a commit
that referenced
this pull request
May 15, 2026
…coped (#514) ## Summary #513 over-reached: while correctly moving `CLOUDFLARE_API_TOKEN` to the `cloudflare-deploy` environment, it also changed the codex refresher's `gh secret set` to `--repo "$REPO" --env codex-auth-refresh`, scoping `CODEX_AUTH_JSON` into the `codex-auth-refresh` environment. `CODEX_AUTH_JSON` is the runtime Codex auth that **every consumer workflow** reads (`tend-review`, `tend-mention`, `tend-triage`, `tend-nightly`, `tend-review-runs`). None of them declare `environment: codex-auth-refresh`, so `${{ secrets.CODEX_AUTH_JSON }}` resolved to an empty string and the codex action failed its auth preflight (`No Codex auth configured`) on every consumer run. Verified on a `workflow_dispatch` of `tend-review-runs` against the codex-harness branch. Only `CODEX_REFRESH_PAT` (the secrets-write credential) should be env-scoped. This drops the `--env` flag so the refresher writes `CODEX_AUTH_JSON` back at repo scope, and adds a comment so it doesn't regress. The job keeps `environment: codex-auth-refresh` to read the env-scoped PAT — env-scoped jobs still see repo secrets, so it reads/writes `CODEX_AUTH_JSON` at repo scope. The `worker-deploy` → `cloudflare-deploy` parts of #513 are correct and untouched. ## Test plan - [ ] Pre-commit + actionlint pass (verified locally) - [ ] After merge: trigger `codex-auth-refresh` — it reads the still-env-scoped valid token, writes a repo-level `CODEX_AUTH_JSON` - [ ] Confirm `CODEX_AUTH_JSON` appears as a repo secret - [ ] Delete the now-redundant env-scoped `CODEX_AUTH_JSON` - [ ] Re-run `tend-review-runs` on the codex branch — codex authenticates Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uvx tend@latest checkflagged two failures againstmax-sixty/tend; this PR carries the workflow/doc half of the fix. The GitHub-state half (ruleset, environments, secret moves) was applied out-of-band via the API.CLOUDFLARE_API_TOKENandCODEX_AUTH_JSONwere repo-level secrets — readable by any workflow, including PR-triggered ones. Both are now stored inmain-pinned GitHub environments (the same shape PyPI release and the codex refresher PAT already use), so PR runs can't read them.worker-deployruns in the newcloudflare-deployenvironment; the codex refresher writes the rotated secret back to itscodex-auth-refreshenvironment instead of repo level. A fresh scoped Cloudflare token (tend-ci-worker-deploy) was minted and the old repo-level secrets deleted.The third check failure (
branch-protection:v1) was fixed purely via the API by extending the existing "Merge access" ruleset to coverrefs/heads/v1; no file change.uvx tend@latest checknow reports all PASS.