Skip to content

secrets: scope worker-deploy and codex-refresh to protected environments - #513

Merged
max-sixty merged 1 commit into
mainfrom
tend-check-fixes
May 15, 2026
Merged

max-sixty merged 1 commit into
mainfrom
tend-check-fixes

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

uvx tend@latest check flagged two failures against max-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_TOKEN and CODEX_AUTH_JSON were repo-level secrets — readable by any workflow, including PR-triggered ones. Both are now stored in main-pinned GitHub environments (the same shape PyPI release and the codex refresher PAT already use), so PR runs can't read them. worker-deploy runs in the new cloudflare-deploy environment; the codex refresher writes the rotated secret back to its codex-auth-refresh environment 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 cover refs/heads/v1; no file change.

uvx tend@latest check now reports all PASS.

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]>
@max-sixty
max-sixty merged commit 2528ca9 into main May 15, 2026
6 checks passed
@max-sixty
max-sixty deleted the tend-check-fixes branch May 15, 2026 22:02
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]>
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