Skip to content

feat(actions): declare api_key_v2 on Datadog credential issuance outputs (stacked on #53) - #54

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

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

Conversation

@highb

@highb highb commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Squire (anthropic/claude-sonnet-5-5): Datadog's three credential issuance actions now declare api_key_v2 on their secret return, with handler-level proof that the declaration gates issuance.

Parent: #53 (highb/datadog-sdk-typed-secret-contract @ 612e8a59196d4e5fe17ad215ba75728d81811ab0), which itself stacks on #51 (da60e29c69975b2bb0dff6f85cd792ca500c1fc5). Review and merge order: #51, #53, 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 #53. Unreleased; no replace.

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

  • SecretContentType: "api_key_v2" on the secret return of issue_service_account_application_key, issue_organization_api_key and issue_service_account_access_token. Payload bytes, native header names, scopes and revocation are unchanged.
  • Existing action tests move from opaque or JWK-only AAD to the typed AAD the SDK now requires (purpose=c1/fk-credential-delivery, version=1, content_type=api_key_v2).
  • TestDatadogIssuanceActionsDeclareAPIKeyV2: every issuance action declares exactly one secret return typed api_key_v2.
  • TestDatadogDeclaredSecretProof: actual connector registration, ListActionSchemas, InvokeAction and SDK JWE against a random-loopback httptest provider. Missing, opaque, generic, wrong-type, wrong-purpose and wrong-version AAD each fail with zero provider requests; a valid request makes exactly one create and the decrypted bytes equal the expected canonical JSON. Requested scopes reach the HTTP body and granted scopes appear in the payload.
  • 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 2b8c6aa9)

  • 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 both new tests fail on the api_key_v2 assertion; restoring the source gives an identical sha256 and the tests pass again.

Limits: no live Datadog calls; the HTTP fixture is not a real provider. These tests do not prove the C1 to Multipass path. Only one action is exercised end to end here; the other two are covered by schema assertion plus the existing native payload test with typed AAD.

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

🤖 Generated with Claude Code

highb and others added 4 commits October 23, 2026 16:52
Declare SecretContentType api_key_v2 on the secret return of all three
issuance actions, move the existing action tests onto typed AAD, and add
handler-level proof: schema declaration for every action and, for the
service account application key, an actual SDK InvokeAction through a
random-loopback provider fixture and SDK JWE with exact payload bytes.
Missing, opaque, generic, wrong-type, wrong-purpose and wrong-version AAD
refuse before any provider request.

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 three Datadog issuance kinds encode through secretcontracts.APIKeyV2, so
the validated content type and bytes travel together. The declaration and the
plaintext schema come from the exported type ID and the helper's returned
content type; a mismatch fails the action rather than being overwritten.

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