-
Notifications
You must be signed in to change notification settings - Fork 373
Harden production promotion workflow #760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |||||
|
|
||||||
| These commands are generated by [cpflow](https://github.com/shakacode/control-plane-flow). | ||||||
| For full setup, version-pinning, and troubleshooting details, see the upstream | ||||||
| [CI automation guide](https://github.com/shakacode/control-plane-flow/blob/v5.0.4/docs/ci-automation.md). | ||||||
| [CI automation guide](https://github.com/shakacode/control-plane-flow/blob/9ef104c246670d6c1ea4132dfd22be68ef930a70/docs/ci-automation.md). | ||||||
|
|
||||||
| ## Pull Request Commands | ||||||
|
|
||||||
|
|
@@ -23,23 +23,11 @@ For the normal generated review-app path, GitHub needs one repository secret: | |||||
| | --- | --- | --- | | ||||||
| | `CPLN_TOKEN_STAGING` | Repository secret | Control Plane service-account token for the staging/review org. | | ||||||
|
|
||||||
| For public repositories, use a staging/review token that cannot access | ||||||
| production Control Plane resources. Generated review-app deploys skip fork PR | ||||||
| heads because Docker builds use repository secrets. If a forked change needs a | ||||||
| review app, first move the reviewed change to a trusted branch in this | ||||||
| repository. | ||||||
|
|
||||||
| No repository variables are required for the standard review-app path when | ||||||
| `.controlplane/controlplane.yml` has exactly one review app entry with | ||||||
| `match_if_app_name_starts_with: true`. cpflow infers the review-app prefix and | ||||||
| staging org from that config. | ||||||
|
|
||||||
| Review apps run pull request code. Any value mounted through | ||||||
| `cpln://secret/...` can be read by that code after the workload starts, so keep | ||||||
| review-app secret dictionaries limited to disposable databases, review-only | ||||||
| renderer credentials, and license values that are acceptable for review-app | ||||||
| exposure. | ||||||
|
|
||||||
| Optional overrides exist for forks, clones, and unusual apps: | ||||||
|
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This update removes two security-relevant paragraphs that were previously present:
Additionally, the If these paragraphs were removed intentionally as part of the upstream generator update, consider preserving the security guidance as local additions to this file so future consumers of this template are not left without it. Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||
| | Name | Notes | | ||||||
|
|
@@ -89,7 +77,7 @@ normal environment-gated job cannot tell which secret scope supplied a nonempty | |||||
| value, so a broader secret with the same name can mask a missing environment | ||||||
| secret. | ||||||
|
|
||||||
| If promotion fails with | ||||||
| If the promotion workflow fails with | ||||||
| `CPLN_TOKEN_PRODUCTION is not set. Add it as a secret on the 'production' GitHub Environment.`, | ||||||
| the token is missing from the environment scope or the workflow job is no longer | ||||||
| declaring `environment: production`. Create or verify the environment secret | ||||||
|
|
@@ -98,27 +86,31 @@ You need permission to manage repository environments and secrets to run these | |||||
| commands. | ||||||
|
|
||||||
| ```sh | ||||||
| gh secret set CPLN_TOKEN_PRODUCTION --repo shakacode/react-webpack-rails-tutorial --env production | ||||||
| gh secret list --repo shakacode/react-webpack-rails-tutorial --env production | ||||||
| gh secret list --repo shakacode/react-webpack-rails-tutorial | ||||||
| gh secret list --org shakacode | grep '^CPLN_TOKEN_PRODUCTION[[:space:]]' || true | ||||||
| gh secret set CPLN_TOKEN_PRODUCTION --repo OWNER/REPO --env production | ||||||
| # Paste the token value when prompted. | ||||||
| gh secret list --repo OWNER/REPO --env production | ||||||
| gh secret list --repo OWNER/REPO | ||||||
| gh secret list --org OWNER | grep '^CPLN_TOKEN_PRODUCTION[[:space:]]' || true | ||||||
| ``` | ||||||
|
|
||||||
| Before the first promotion, bootstrap the production app the same way in the | ||||||
| production org, using production-only secrets and values. | ||||||
|
|
||||||
| ## Version Locking | ||||||
|
|
||||||
| Generated wrappers pin Control Plane Flow with a release tag, for example | ||||||
| `v5.0.4`. Reusable review-app, staging, cleanup, and helper workflows pin the | ||||||
| tag in their `uses:` ref. Production promotion pins the same tag in the | ||||||
| `Checkout control-plane-flow actions` step so the caller-owned job can keep | ||||||
| Generated wrappers normally pin Control Plane Flow with a release tag, for | ||||||
| example `v5.1.0`. This branch temporarily pins the wrappers to upstream commit | ||||||
| `9ef104c246670d6c1ea4132dfd22be68ef930a70` while testing unreleased production | ||||||
| promotion hardening. Reusable review-app, staging, cleanup, and helper workflows | ||||||
| pin that ref in their `uses:` entry. Production promotion pins the same ref in | ||||||
| the `Checkout control-plane-flow actions` step so the caller-owned job can keep | ||||||
| `environment: production` and receive production environment secrets directly. | ||||||
|
|
||||||
| Leave `CPFLOW_VERSION` unset so the workflow builds cpflow from the same | ||||||
| checked-out upstream source. If you set `CPFLOW_VERSION`, it must match the | ||||||
| release tag, for example `CPFLOW_VERSION=5.0.4` with a wrapper pinned to | ||||||
| `uses: ...@v5.0.4`. | ||||||
| release tag your wrappers are pinned to: a `CPFLOW_VERSION=5.1.x` runtime | ||||||
| override goes with a wrapper pinned to `uses: ...@v5.1.x` (substitute the | ||||||
| release you pinned above). | ||||||
|
|
||||||
| After updating the `cpflow` gem in this repo, update the generated wrappers in | ||||||
| the same PR: | ||||||
|
|
@@ -151,7 +143,7 @@ Most apps do not need these: | |||||
| | Name | Notes | | ||||||
| | --- | --- | | ||||||
| | `DOCKER_BUILD_EXTRA_ARGS` | Newline-delimited extra Docker build tokens. | | ||||||
| | `DOCKER_BUILD_SSH_KEY` | Read-only, revocable deploy key for Docker builds that fetch private dependencies. Do not use a personal SSH key. | | ||||||
| | `DOCKER_BUILD_SSH_KEY` | Private SSH key for Docker builds that fetch private dependencies. | | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous description was: The new text drops "read-only, revocable" and the explicit warning against personal SSH keys. These are meaningful security constraints — a personal SSH key has much broader access than a deploy key, and the "revocable" property is important for incident response. Suggest restoring the original guidance:
Suggested change
|
||||||
| | `DOCKER_BUILD_SSH_KNOWN_HOSTS` | SSH known_hosts entries when SSH build hosts are not GitHub.com. | | ||||||
| | `REVIEW_APP_DEPLOYING_ICON_URL` | Cosmetic custom image URL for the animated deploying icon. Set to `none` to use the text fallback icon. | | ||||||
| | `STAGING_APP_BRANCH` | Custom staging branch. The branch must also appear in `cpflow-deploy-staging.yml`'s push filter. | | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two security-relevant paragraphs were removed from this section. Consider restoring them:
Fork PR token isolation (was between the token table and "No repository variables are required…"):
Review app secret exposure (was before "Optional overrides exist…"):
Both are actionable operator guidance — especially for public repos where untrusted contributors can open PRs. Removing them increases the chance of a misconfigured deployment that exposes production-grade secrets to review app code.