feat(contrib/keyvault): add Azure Key Vault TokenStore#83
Open
sergiopalacio wants to merge 2 commits intomasterfrom
Open
feat(contrib/keyvault): add Azure Key Vault TokenStore#83sergiopalacio wants to merge 2 commits intomasterfrom
sergiopalacio wants to merge 2 commits intomasterfrom
Conversation
Implements microsoft.TokenStore backed by Azure Key Vault, so distributors can persist MS SAM refresh tokens in the vault instead of local disk. Lives in a separate submodule (plugins/contrib/microsoft/keyvault) so the Azure SDK does not leak into the default chaperone binary or existing contrib consumers. Secret names are SHA-256 hex of the tenantID (Key Vault names forbid dots; a naive dot-to-hyphen mapping collides), with the original tenantID preserved as a tag for operator visibility. Distributors supply an azcore.TokenCredential of their choice. The onboarding CLI is unchanged -- operators pipe its stdout into az keyvault secret set using the same SHA-256 hex encoding, documented in the onboarding guide.
The test, test-race, test-cover, lint, lint-fix, fmt, vet, and tidy targets iterate over each module explicitly -- add plugins/contrib/microsoft/keyvault so CI actually picks it up. gosec and govulncheck left unchanged: neither currently covers plugins/contrib either, so adding only keyvault would be inconsistent.
|
|
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
Adds
microsoft.TokenStorebacked by Azure Key Vault as a sibling to the existingFileStore. Distributors using Microsoft SAM can now persist MRRT refresh tokens in a vault instead of (or alongside) local disk.plugins/contrib/microsoft/keyvault/with its owngo.modso the Azure SDK does not leak into the defaultchaperonebinary or any contrib consumer that uses onlyFileStore/oauth/mux. Verified:go tool nmon the compiled binary finds 0 Azure symbols.{prefix}{hex(sha256(tenantID))}. Key Vault secret names forbid dots, and a naive dot-to-hyphen mapping collides (my-a.bvsmy.a-b). SHA-256 guarantees collision safety and a valid-alphabet output. The originaltenantIDis preserved on atenantIDtag for operator visibility; secrets are also taggedmanagedBy=chaperone.azcore.TokenCredential(Default / Managed Identity / Workload Identity / Client Secret). No credential-type flags inkeyvault.Config.SecretNotFound(HTTP 404 + specific ErrorCode) maps tocontrib.ErrTenantNotFound; all other failures propagate wrapped.chaperone-onboard microsoftstdout intoaz keyvault secret setusing the same SHA-256 hex encoding. Recipe added todocs/guides/onboarding-refresh-tokens.md.Verification
make buildmake lint(all 4 modules)make vetmake test-racegosecon keyvault submodulegovulncheckon keyvault submodulego test -race -count=10Code review via
go-revieweragent: passed, both Priority B findings (unused logger infra, pointer-identity logger tests) addressed.Commits
feat(contrib/keyvault): add Azure Key Vault TokenStore— submodule, tests, docs, workspace wiring.chore(make): include keyvault submodule in multi-module targets— sotest,test-race,test-cover,lint,lint-fix,fmt,vet,tidyactually walk into the new module.Test plan
feat/keyvault-pluginplugins/contrib/microsoft/keyvaultin an IDESecrets User+Secrets Officer, orget+setaccess policy) matches what's actually neededOut of scope
cmd/chaperone-onboard— a dedicated Key Vault subcommand would be a follow-up.RefreshTokenSourcealready caches access tokens; re-caching refresh tokens here would duplicate state.gosec/govulnchecktargets do not scan the new submodule, because they also don't scanplugins/contrib. Adding both together would be a separate follow-up.Related
plugins/contrib/microsoft/store.goplugins/contrib/microsoft/filestore.go