security: bind Cloudflare deploys to protected main - #298
lawrencecchen wants to merge 3 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I have read the CLA Document v2.2 and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
e88edd0 to
0af136d
Compare
Summary
mainref, exact workflow ref, and matching currentmaincommit SHA.contents: read, timeouts, and strict shell mode.Repository settings prerequisite
Configure required reviewers and branch restrictions for
subrouter-stagingandsubrouter-productionin GitHub environment settings. YAML cannot create environment protection rules. This PR only ensures an approved deployment cannot receive secrets from an arbitrary ref.Testing
bash tests/test_cloudflare_dispatch_guard.shbash -n .github/scripts/authorize-cloudflare-deploy.sh tests/test_cloudflare_dispatch_guard.shshellcheck --shell=bash .github/scripts/authorize-cloudflare-deploy.sh tests/test_cloudflare_dispatch_guard.shactionlint -shellcheck .github/workflows/cloudflare-do.ymlgit diff --checkCommits
The first commit adds the behavior tests and is expected to fail without the guard. The second commit implements the guard.
Summary by cubic
Previously, any push or manual dispatch on
maincould deploy to Cloudflare. The workflow now authorizes the source before any verify/deploy job, checks out that authorized commit, and fails closed for branches, tags, unprotectedmain, or workflow ref/SHA mismatches; pull request verification stays read-only and never authorizes a deploy.Migration
subrouter-stagingandsubrouter-productionin GitHub environment settings; YAML cannot create these protection rules.Written for commit 407b0e6. Summary will update on new commits.