mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
Repository code outside .github/ needs no review, but every deploy job held a Cloudflare token strong enough to write any Worker on the account (the data sync Workflow PUT has no per-Worker permission). A dev merge could therefore overwrite production Workers. Split each service into a build job with no environment, secrets, or OIDC token that uploads a SHA256SUMS artifact, and a deploy job in dev|production that checks out only .github/release/, verifies the artifact against the build job's digest, installs the cf/wrangler CLI pinned here, and runs only deploy-*.sh. The deploy scripts treat the artifact as data and refuse it unless its resolved config equals the pinned target in .github/release/targets/ exactly: Worker names, routes, custom domains, crons, Workflow names, and bindings. For cf services the pinned config is what cf reads. That is what makes an account-wide token safe, and it keeps production out of reach of a dev merge. Adds the cf 1.0.0-beta.12 and wrangler 4.110.0 lockfiles the deploy jobs install with npm ci --ignore-scripts.
1.1 KiB
1.1 KiB
Pinned deploy targets
These files are the allow-list for the deploy jobs that hold a Cloudflare
token. deploy-*.sh refuses an artifact whose resolved config is not exactly
one of these files, then deploys the pinned config (never the artifact's copy).
The deploy token can write every Worker on the account (the data sync Workflow
needs account-wide Workers Scripts Write; Cloudflare has no per-Worker
Workflows permission), so changing what a stage can deploy means changing these
files, which CODEOWNERS (/.github/ @thdxr) reviews.
site/,legacy/,data/: expectedv0/config.jsonandv0/workers/<dir>/worker.config.jsonfrom thecfBuild Output artifact.files/,update/: the completewrangler.jsonthe deploy script passes to the pinned wrangler CLI. The artifact is only the bundledindex.js; these services have no config in the artifact to trust.
A Worker's own code and assets are expected to change freely. Names, routes, custom domains, crons, Workflow/export names, and every binding (including service bindings to other Workers) are pinned here.