Repository navigation
refactor(guest): hold no key vendor backend as None, not a fake one - #1560
Draft
freshtonic wants to merge 1 commit into
Draft
freshtonic wants to merge 1 commit into
freshtonic wants to merge 1 commit into
Conversation
GuestVendor::None was a vendor that was not there. It said its vendor was Static, it offered no key mode, and every call failed. It existed only because KeyRouter needed a vendor, even for a client with none. KeyRouter now holds an Option of the vendor key source. KeyRouter::zerokms_only makes a router with no vendor, and it sends every request to ZeroKMS. KeyRouter::vendor returns an Option. The guest builds a vendor key source only when the config names a backend, and picks new or zerokms_only from that. GuestVendor has no None variant, and the dispatch has no arm for it. A config with no ZeroKMS key and no backend does not parse, and cipher_init refuses it again rather than build a client with no key source. The routing does not change: with no vendor, every request went to ZeroKMS before, and it does now. A new router test shows it.
Contributor
|
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 |
🦋 Changeset detectedLatest commit: d10c9dc The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Summary
The Go guest (the WebAssembly module that does the encryption for the Go SDK) used a fake vendor,
GuestVendor::None, when no key vendor backend was set. It said its vendor wasStaticand failed every call. It was anOptionin disguise. This PR uses a realOption.No routing behaviour changes: with no vendor, every request goes to ZeroKMS, as before.
Changes
stack-kms-vendor:KeyRouterholdsOption<VendorKeySource<B>>. NewKeyRouter::zerokms_only.KeyRouter::vendor()returns anOption(an API change, unpublished). New router test for the no-vendor case.GuestVendor::Noneandno_vendor()are gone. The guest builds a vendor key source only when the config names a backend. A config with no ZeroKMS key and no backend (which already cannot parse) is refused explicitly.@cipherstash/authpatch.Verification
Run on the top branch of this stack (
james/kms-vendor-dispatch), on macOS:cargo fmt --all --checkandcargo clippy --workspace --all-features --all-targets -- -D warnings: pass.mise x --env test -- cargo nextest run --workspace --all-features: 1401 of 1402 pass. The one failure isstack-encrypt::ui derive_diagnostics(trybuild). It fails on every snapshot because of a local rustc wrapper that changes the paths in the compiler output. This stack does not touchstack-encrypt. CI is the check for it.mise run wasm:guest:test: 80 of 80 pass.go vet ./...andgo test -count=1 ./...inlanguages/golang: pass.pnpm --filter @cipherstash/auth test: 92 pass.pnpm --filter stash test: 1667 pass.cargo checkof the workspace and the guest (native andwasm32-wasip1) on each branch of the stack: pass.Related
Refs #1541. Code-smell follow-up to the key vendor backend stack.