Repository navigation
Conversation
The prd deploy and the quarterly restore drill each held a long-lived PlanetScale service token in Infisical. Both now trade the job's GitHub OIDC token for a 45-minute service token through planetscale/auth-action, from a trust that accepts only their GitHub environment (production, production-eu, maintenance). The org slug still comes masked from Infisical because the run logs are public.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
This branch has not been deployed
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.
Why
The prd deploy (
deploy-prd-instance.yml) and the quarterly restore drill (backup-restore-test.yml) each read a long-lived PlanetScale service token from Infisical. The deploy token can change prd schema. PlanetScale now trades a GitHub Actions OIDC token for a short-lived service token, the same way we already authenticate to AWS and Infisical.What changes
planetscale/auth-action(pinned to v1.0.0's SHA) after Infisical loads. They pass the minted token only to the step that needs it:PLANETSCALE_API_TOKEN_ID/PLANETSCALE_API_TOKENfor alchemyPLANETSCALE_SERVICE_TOKEN_ID/PLANETSCALE_SERVICE_TOKENforpscalemaintenancejob can't mint a deploy token.PLANETSCALE_OIDC_TRUST_ID. The org slug stays in Infisical (PLANETSCALE_ORGANIZATION/PLANETSCALE_ORG) because it's masked there and these run logs are public.docs/persistence.mdanddocs/backup-and-recovery.mddescribe the trusts and include thepscale oidc-trust createcommands. This also drops the stale claim that the preview-orphan sweep uses the drill's token: previews moved to Neon and the sweep no longer touches PlanetScale.Rollout (needs a PlanetScale org admin; do 1 and 2 before merging)
Merging triggers a prd deploy. Without the trust variable,
auth-actionfails and the deploy stops before alchemy runs.--max-ttl 2700, which is the 45-minute job timeout. Usepscale0.351 or newer, or the dashboard under Settings > OpenID Connect.productionandproduction-eu: copy the accesses of the current deploy token (pscale service-token show-access <id>) on each instance's database.maintenance: the drill's seven accesses onmaple, listed indocs/backup-and-recovery.md.pscale oidc-trust providers show github_actionsfirst to see which conditions the provider requires.PLANETSCALE_OIDC_TRUST_IDon the GitHub environmentsproduction,production-euandmaintenance.gh workflow run backup-restore-test.yml.PLANETSCALE_API_TOKEN_ID/PLANETSCALE_API_TOKENfrom Infisicalprodandprod-eu, andPLANETSCALE_SERVICE_TOKEN_ID/PLANETSCALE_SERVICE_TOKENfromdev. Then revoke those service tokens in PlanetScale.Verification
actionlintandoxfmt --checkpass on the changed files.core.setSecreton the minted token, and its outputs match the names alchemy (AuthProvider.tsenv resolution) andpscaleread.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.