Skip to content

feat(actions): declare api_key_v2 on Snowflake PAT action output (stacked on #163) - #164

Draft
highb wants to merge 4 commits into
highb/snowflake-sdk-typed-secret-contractfrom
highb/snowflake-declare-api-key-v2
Draft

highb wants to merge 4 commits into
highb/snowflake-sdk-typed-secret-contractfrom
highb/snowflake-declare-api-key-v2

Conversation

@highb

@highb highb commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Squire (anthropic/claude-sonnet-5-5): The Snowflake programmatic access token action now declares api_key_v2 on its secret return, with handler-level proof that the declaration gates issuance.

Parent: #163 (highb/snowflake-sdk-typed-secret-contract @ 0abc372c4bd51bc5134ca9ff46456b7c8db4d6ae), which itself stacks on #160 (e60de151cc81a3a5be05ee5d996d179b92c9130c). Review and merge order: #160, #163, this PR. Retarget to the parent's successor as each lands.

Dependency: baton-sdk v0.42.4-0.20261023162145-b4c6a5b06b11 (commit b4c6a5b06b118bf6b74cf10a5dc5a3597e83138b of baton-sdk#1192), carried by #163. Unreleased; no replace.

What changes (one commit, 3 files under pkg/connector)

  • SecretContentType: "api_key_v2" on the secret return of issue_programmatic_access_token. Native TOKEN payload, header name, role and scope handling, and revocation are unchanged.
  • Existing PAT action tests move from opaque AAD to the typed AAD the SDK now requires (purpose=c1/fk-credential-delivery, version=1, content_type=api_key_v2), and the schema/gate test asserts the declaration.
  • TestSnowflakeDeclaredSecretProof: actual connector registration, ListActionSchemas, InvokeAction and SDK JWE against a random-loopback httptest Snowflake SQL API fixture. Missing, opaque, generic, wrong-type, wrong-purpose and wrong-version AAD each fail with zero provider statements; a valid request issues exactly one ADD PROGRAMMATIC ACCESS TOKEN and no REMOVE, and the decrypted bytes equal the expected canonical JSON.
  • The same test can read CONNECTOR_SECRET_PROOF_INPUT and write CONNECTOR_SECRET_PROOF_RESULT files so C1 can feed its prepared request through the real handler. This is a test port only, not a shipping interface.

Verification (local, commit 1a5a1f7a)

  • go build ./... exit 0; go test -count=1 ./... exit 0, no skips.
  • golangci-lint v2.14.0 (CI's pin): 0 issues. Two //nolint:gosec annotations cover the test-only file ports whose paths come from the harness environment.
  • Negative control: changing the declared type to api_key (compiles) makes TestSnowflakeDeclaredSecretProof and the schema/gate test fail on their named assertions; restoring the source gives an identical sha256 and the tests pass again.

Limits: no live Snowflake calls; the HTTP fixture is not a real provider. These tests do not prove the C1 to Multipass path.

Supersession: replaces the typed-declaration portion of #162, which stays untouched until a decision is made on it.

🤖 Generated with Claude Code

highb and others added 4 commits October 23, 2026 16:55
Declare SecretContentType api_key_v2 on the programmatic access token
secret return, move the existing action tests onto typed AAD, and add
handler-level proof: an actual SDK InvokeAction through a random-loopback
Snowflake SQL API fixture and SDK JWE with exact payload bytes. Missing,
opaque, generic, wrong-type, wrong-purpose and wrong-version AAD refuse
before any provider SQL.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The Snowflake PAT API_KEY arm encodes through secretcontracts.APIKeyV2, so the
validated content type and bytes travel together. The declaration uses the
exported type ID and the action fails if the issued plaintext does not carry
it, rather than overwriting its schema.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Generated by go mod vendor from the previous commit.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant