feat(pat): configure credential issuance separately from secret syncing - #151
Open
c1-squire-dev[bot] wants to merge 4 commits into
Open
Conversation
sync-secrets gated four things at once: the secret and RSA public key syncers, the programmatic access token syncer, the token child-resource annotation, and the credential issuer itself. A tenant that wanted a secret inventory had to grant token minting to get it, and a tenant that wanted issuance had to take a full secret inventory it may not want. issue-credentials splits the issuer out. The two flags are independent, with one deliberate overlap: the programmatic access token type is synced when either is set. Issuance advertises DISCOVERABLE, so enabling it has to make issued tokens syncable even with the broader secret sync off, or the credential exists with nothing holding a handle to revoke it. secretOptions.tokensSynced carries that rule in one place rather than repeating the disjunction at each site. | sync-secrets | issue-credentials | secret types synced | issuer | |---|---|---|---| | off | off | none | no | | on | off | secret, rsa_public_key, programmatic_access_token | no | | off | on | programmatic_access_token | yes | | on | on | all three | yes | Nothing regresses: credential issuance is not on main, so no tenant has it today, and sync-secrets keeps doing exactly what it does now. issue-credentials defaults to off, which is the right default for a capability that mints credentials. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Generated by go run ./pkg/config/gen. Note that make generate does not do this: there is no //go:generate directive in pkg/config, so go generate ./pkg/config is a no-op, and the generator writes conf.gen.go to the repo root rather than into pkg/config. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The help block in the README is a hand-maintained snapshot that has drifted from the real --help output well beyond this flag: it is missing --auth-method, --health-check, --http-timeout-seconds, --storage-engine, --workers and the external-resource and otel flags, and several descriptions are stale. Nothing in CI gates it. Refreshing the whole block is left alone here rather than bundled into an unrelated change. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Fifth in the stack, after #150. Splits credential issuance out of
sync-secretsinto its ownissue-credentialsflag, and documents it.Why
sync-secretsgated four separate things: thesecretandrsa_public_keysyncers, theprogrammatic_access_tokensyncer, the token child-resource annotation, and the credential issuer itself. So a tenant who wanted a secret inventory had to grant the connector the ability to mint tokens to get it, and a tenant who wanted issuance had to take a full secret inventory they may not want. Neither is a choice they should be forced into.What the flags mean now
sync-secretsissue-credentialssecret,rsa_public_key,programmatic_access_tokenprogrammatic_access_tokenIndependent, with one deliberate overlap: the
programmatic_access_tokentype is synced when either flag is set. Issuance advertisesCREDENTIAL_RESOURCE_MODE_DISCOVERABLE, so turning it on has to make issued tokens syncable even when the broader secret sync is off — otherwise the credential exists with nothing holding a handle to revoke it, which is the defect this stack opened by fixing.secretOptions.tokensSyncedholds that rule in one place instead of repeating the disjunction at each site.TestSecretFlagsGateIndependentlypins all four rows, asserting both the advertised resource-type set and the user resource's child annotations, so the annotations cannot drift away from the types they gate.Compatibility
Nothing regresses. Credential issuance is not on
main—d1a71db2is not an ancestor of it andmain'sbaton_capabilities.jsoncarries noCAPABILITY_CREDENTIAL_ISSUE— so no tenant has issuance today, andsync-secretskeeps doing exactly what it does now.issue-credentialstherefore defaults to off, which is the right default for a capability that mints credentials.baton_capabilities.jsonis unchanged:cmd/baton-snowflake/main.gopasses both flags to the default-capabilities builder, so the advertised set is the same as before.Docs
The issuance section now names the flag and states that the two are independent. The setup step previously said only "Optional. Enable Sync secrets to display them on the Inventory page" — framed purely as display, with nothing telling a reader that issuance needed it. There is now a step for each flag.
Verification
go test ./pkg/...andgolangci-lint run ./pkg/... ./cmd/...are clean. Both directions were also checked against a live Snowflake account, in process through the realConnectorServer:issue-credentialsalone,sync-secretsoff — full lifecycle, and a real sync discovers the token, which is the case the annotation rule exists for:sync-secretsalone,issue-credentialsoff — the issuer is genuinely gone rather than merely unadvertised:One thing worth knowing, not fixed here
make generatedoes not regeneratepkg/config/conf.gen.go. There is no//go:generatedirective anywhere inpkg/config, so itsgo generate ./pkg/configis a no-op, and running the generator directly (go run ./pkg/config/gen) writesconf.gen.goto the repo root rather than intopkg/config. The regenerated file is committed separately here; the Makefile is left alone since it is unrelated to this change.