feat: prototype Snowflake named key pair issuance - #138
feat: prototype Snowflake named key pair issuance#138c1-squire-dev[bot] wants to merge 9 commits into
Conversation
| func (r *ListNamedKeyPairsRawResponse) GetKeyPairs() ([]NamedKeyPair, error) { | ||
| keyPairs := make([]NamedKeyPair, 0, len(r.Data)) | ||
| for _, row := range r.Data { | ||
| keyPair := &NamedKeyPair{} | ||
| if err := r.ResultSetMetadata.ParseRow(keyPair, row); err != nil { | ||
| return nil, err | ||
| } | ||
| keyPairs = append(keyPairs, *keyPair) | ||
| } | ||
| return keyPairs, nil | ||
| } |
There was a problem hiding this comment.
🟡 Suggestion: ParseRow requires every field mapped in namedKeyPairStructFieldToColumnMap to be present in the result set with an exact type match — string columns must be text and CreatedOn/LastUsedOn/ExpiresAt must be timestamp_ltz, otherwise it returns row type ... not found / type errors and the whole named_key_pair List fails. SHOW USER KEY PAIRS output may not include every mapped column (e.g. role_scope, rotated_to, comment) or may type timestamps differently. The same class of fragility is already worked around for DESCRIBE USER via ignoredUserStructFieldsForDescribeOperation. Consider verifying the actual column set against a live response and adding an ignore-list / graceful degradation, plus a table-driven parse test. (medium confidence)
There was a problem hiding this comment.
Addressed and retained through the rebase: optional SHOW columns are tolerated via IsOptionalField, SHOW-family timestamps accept both timestamp_ltz and text, and TestListNamedKeyPairsRawResponseGetKeyPairsToleratesOptionalColumns covers the reduced/text-timestamp response. go test -count=1 ./... passes at 1082ff7.
Connector PR Review: feat: prototype Snowflake named key pair issuanceBlocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0 Review SummaryThe new commit gates the Security IssuesNone found. Correctness IssuesNone found. SuggestionsNone. |
|
Updated to finalized SDK commit |
|
|
||
| require ( | ||
| github.com/conductorone/baton-sdk v0.19.0 | ||
| github.com/conductorone/baton-sdk v0.19.2-0.20260722080606-a675375c27d2 |
There was a problem hiding this comment.
🟠 Bug: This bumps baton-sdk to the unreleased prototype pseudo-version v0.19.2-0.20260722080606-a675375c27d2, but .versions.yaml (baton-admin managed, "DO NOT EDIT") still pins v0.19.0. The two disagree, and the new credential-issue code depends on SDK APIs (connectorbuilder.CredentialIssuerV2, rs.SyncOpAttrs/SyncOpResults, CredentialIssueInput/Output) that a released v0.19.0 likely does not contain — so .versions.yaml cannot simply win. Reconcile before merge by moving to a released SDK that actually contains these APIs and updating both files together. Shipping against the prototype pseudo-version remains a release blocker (previously reported, still open).
There was a problem hiding this comment.
Resolved at 1082ff7: the branch is rebased onto main, go.mod and the baton-admin-managed .versions.yaml both use released baton-sdk v0.20.2, and prototype vendor changes were replaced with the released v0.20.2 vendor tree. The connector was also updated for the final v0.20.2 issuance/delete contract; tests, lint, build, and generated capabilities pass locally.
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Use explicit JOSE RSA profiles, issuance-level lifetimes, dynamic service-user eligibility, and resilient named-key row parsing with regression coverage. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Centralize Snowflake service-user type constants and simplify the RSA public-key assertion. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Reuse service-user, RSA key-type, and result-column constants and wrap the eligibility signature. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Regenerate credential issuance capabilities and document named key-pair issuance constraints. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
7384b20 to
1082ff7
Compare
| } | ||
| keyPairs, err := b.client.ListUserKeyPairs(ctx, parent.GetResource()) | ||
| if err != nil { | ||
| return nil, nil, fmt.Errorf("baton-snowflake: list named key pairs: %w", err) |
There was a problem hiding this comment.
🟡 Suggestion: Unlike rsaBuilder.List, which swallows the 422 "no permission to describe user" error and returns nil, nil, nil to degrade gracefully, this returns a hard error. If the named key-pair feature or DESCRIBE permission is unavailable on the account, every service user's sync will fail here. Consider matching the rsa builder's isUnprocessableEntityError skip so an unavailable endpoint degrades gracefully (R7). (medium confidence)
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
|
Followed up on the latest automated review suggestion in b06fd24: named key-pair listing now mirrors the legacy RSA builder and skips Snowflake 422 feature/permission-unavailable responses with a debug log, while continuing to propagate unexpected errors. Added TestNamedKeyPairBuilderListSkipsUnavailableFeature; go test -count=1 ./... and golangci-lint run --allow-parallel-runners pass locally. |
Stale automated changes-requested review: its SDK version blocker is fixed on the current head, and the latest automated full review reports zero blocking issues.
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
|
Closed the opt-in contract gap in 75e5f0b: named_key_pair now carries both OptInRequired and SkipEntitlementsAndGrants while remaining behind --sync-secrets. Added capability-registration tests proving (1) the advertised named-key resource is opt-in, syncable, and deletable but not itself an issuer, (2) user issuance advertises discoverable named_key_pair output only with secret sync enabled, and (3) named_key_pair plus user issuance details are absent when secret sync is disabled. Refreshed baton_capabilities.json. go test -count=1 ./..., golangci-lint, build, and generated capability validation pass locally. |
Summary
DAYS_TO_EXPIRYALTER USER ... REMOVE KEY PAIRWhy named key pairs
Snowflake's named key-pair API avoids the legacy
RSA_PUBLIC_KEY/RSA_PUBLIC_KEY_2two-slot limit and gives each issued credential a stable identifier, fingerprint, status, usage timestamps, and expiration.Safety properties
SERVICEorLEGACY_SERVICE)Dependency
github.com/conductorone/baton-sdk v0.20.2.versions.yamlremains unchanged atv0.20.2Testing
go test -count=1 ./...golangci-lint run --allow-parallel-runnersgo build ./cmd/baton-snowflakebaton_capabilities.jsonrefreshed