Repository navigation
feat(db): seal account tokens by default and backfill them during migrate - #9425
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
cf11071 to
9703f13
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
[Critical impact] The PR appears safe to merge; no new blocking issue was found. SummaryThis PR makes account-token sealing the default with a usable key and adds a backfill during migration.
Reviews (4) · Last reviewed commit: "fix(helm): require the app's ENCRYPTION_..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 21 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…nly on batch timeouts
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 22 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
ENCRYPTION_KEYis 64 hex characters;ENCRYPT_ACCOUNT_TOKENS=false(or0) is the opt-out. A key in any other format keeps writing plaintext and never fails a writeAccount token sealing: disabled (ENCRYPTION_KEY is not a 64-character hex key)at WARN, once per process, ordisabled (ENCRYPT_ACCOUNT_TOKENS is false)at INFO for the opt-out0037_seal_account_tokensas a script migration somigratebackfills stored tokens. The runner gainsScriptMigrationDeferred: a migration that throws it is left unrecorded without failing the run, so the backfill stays pending while sealing is off, or while a batch hits its lock or statement timeout, and runs on a later migrate0036) was recorded, so old pods that cannot read sealed tokens have rolled out before every stored token is sealed. New writes still seal right away, and the docs cover that windowseal-account-tokenstask now refusessealonly when sealing is opted outmigrationsservices now receiveENCRYPTION_KEYandENCRYPT_ACCOUNT_TOKENS, read the same way the app reads them. Chart bumped to 1.11.10Type of Change
Testing
packages/db/script-migrations/0037_seal_account_tokens.integration.ts(real Postgres): migrate seals a mixed plaintext/sealed table and records it; stays pending and untouched withfalse,0, or a non-hex key, then runs once sealing is on; waits out the rollout grace; defers instead of failing when a batch times out on a locked rowapps/sim/lib/oauth/credential-revocation.integration.ts(real Postgres + Redis): sealed writes with the flag unset, plaintext with the opt-out, plaintext with a non-hex keypackages/db/sealed-text.test.ts: a non-hex key writes plaintext and logs one WARN with the reasonapps/sim/background/seal-account-tokens.test.ts: seals with the flag unset, refuses when opted outhelm unittest(2 new cases for the init container env),helm lint --strictbun run lint,check:sealed-columns,check:unused-exports,check:comment-hygiene,check:test-types,check:utils,check:source-conventions,check:docs,check:boundaries,packages/dbtsc; CI runs the full audits and type-checkChecklist
test-auditauthoring gate)