Repository navigation
fix(db): key the provider cache on the operator's managed grant - #2300
Merged
Merged
Conversation
A seed the operator demotes from managed: true to managed: false keeps its id, server and empty credential, so the provider cache kept serving the provider that signed in with the server's identity. Reproduced end to end through POST /api/db/query with BigQuery and a faked Google. credentialDigest now frames "managed" last, only when managed is exactly true, so every connection without the grant keeps its key byte for byte.
Split the managed bullet onto its own line in the credentialDigest docblock, rewrap the public-field list, and put the D85 count line's second sentence on its own line.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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.



The provider cache now keys a connection that carries the operator's
managed: truegrant apart from the same connection without it.managed: truedecides whom an empty credential signs in as: BigQuery and Firestore sign a keyless seed in with the server's own identity only under that grant.The cache key did not frame it, so a seed the operator demoted from
managed: truetomanaged: falsekept its id, server and empty credential, and went on being served the provider that had signed in as the server, until that provider sat idle for 30 minutes.Reproduced end to end before the fix, through the real
POST /api/db/query, operator loader,resolveConnection, factory and BigQuery provider, with only the session and the Google transport faked.After the seed file was rewritten with
managed: falseandGET /api/connections/managedlisted it so, the next query still answered 200, sent with the token granted undermanaged: true, and no new token was requested.User-visible change:
managed: truetomanaged: falseis refused the server's identity on its next request once the seed file reloads; for BigQuery that is the existing "BigQuery needs a service-account key or an access token in the password field" refusal, with no request sent to Google.credentialDigestframesmanagedlast and only when it is exactly true, so every connection without the grant keeps its key byte for byte.A managed connection opens its provider once after the deploy, as after any restart.
docs/BACKLOG.mdD85 records the new test as the sixtieth@/lib/authmock; it spreads the real module and replaces only the session readers.Test plan
bun tests/run-tests.ts tests/api/db/demoted-seed.test.ts: red onmain(the second query answered 200 with the server's token), green with the change.bun tests/run-tests.ts tests/unit/lib/db/provider-cache-key.test.ts: new cases red onmain, green with the change; the keys of connections without the grant are pinned byte for byte.providerCacheKey.bun run format,lint,typecheck,knip,chart:check,channels:showcase:check,readme:check,security:check,test,build.bun run test:coverage && bun run coverage:check.bun run build:lib && bun run attw && bun run lib:closure, and the VS Code extension build.