Skip to content

IGA-5308: Emit Multipass api_key_v2 JSON for org API keys - #55

Draft
highb wants to merge 21 commits into
mainfrom
highb/IGA-5308/emit-multipass-api-key-v2-json
Draft

highb wants to merge 21 commits into
mainfrom
highb/IGA-5308/emit-multipass-api-key-v2-json

Conversation

@highb

@highb highb commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Squire (Together/DeepSeek-V4.1-Flash-1017):

What

Both Datadog credential kinds now issue as Multipass api_key_v2 credentials:

  • Organization API keys return key_value, key_id (Datadog's id, from the
    create response), provider (datadog), base_url (the endpoint the key
    authenticates against: the base-url override when set, otherwise what the
    configured site implies), and header_name (DD-API-KEY).
  • Service account application keys return the same shape plus
    DD-APPLICATION-KEY as header_name and the scopes Datadog reported. Scopes
    the provider did not report are omitted rather than emitted as an empty list,
    which would assert the key is unscoped.

For both, the plaintext is application/vnd.multipass.api_key_v2+json JSON,
PlaintextData.Schema carries that MIME type, and the descriptor declares its
output through CredentialIssueOptionDescriptor.output. Multipass rejects nulls,
so the optional fields use omitempty.

The payload and the declaration both come from the Multipass types in
pkg/multipass: multipass.APIKeyV2 is the payload, multipass.Plaintext sets
the schema from the type id, and multipass.OutputField(name, multipass.TypeAPIKeyV2) builds the descriptor field. The declared type and the
emitted payload therefore cannot disagree — both derive from
multipass.TypeAPIKeyV2. Tags are inherited from multipass.Tags, not
hardcoded, and currently come out as
[credential, api_key, multipass, api_key_v2].

Behavior change

Paper-vault delivery of either Datadog credential kind now stores api_key_v2
JSON rather than the bare key: organization API keys and service account
application keys alike, because the connector cannot tell which delivery target
it is serving.

Until IGA-5311 ships, paper-vault
deliveries also lack the content type: the stored value is the right JSON, but
nothing records that it is api_key_v2.

Viewer rendering for the structured value is
IGA-5309, which is blocked by
IGA-5311.

Dependency

The Multipass types are a temporary copy, not a dependency.
ConductorOne/baton-multipass-sdk cannot be made public yet, so
pkg/multipass/ is copied from it verbatim — tests included — at
v0.0.1, commit b9f4b6776da475759bbcdc18f8209fedab389a6c (private
repository, so the tag and SHA are given rather than a link). Each file carries
a header saying so, and naming
IGA-5320 as the ticket that
replaces the copy with the real module. The package keeps its name and exported
API, so that replacement is an import-path change only.

The descriptor output field comes from baton-sdk #1218. go.mod pins
v0.44.1-0.20261103220501-dc065ae56b48 (the shrunken #1218, which no longer
carries pkg/secret) and the SDK is re-vendored.

Do not merge before baton-sdk#1218 merges. The pin is a pseudo-version, so
the vendor diff also carries upstream baton-sdk commits landed since the tag it
builds on; those are not part of this change, and this PR will be repinned to the
release that includes #1218 before merge.

Tests

  • TestOrgAPIKeyIssueEmitsMultipassAPIKeyV2 — drives Issue and asserts the
    wire JSON has exactly key_value, key_id, provider, base_url,
    header_name, that no value is null, and that Schema is
    multipass.ContentType(multipass.TypeAPIKeyV2).
  • TestAppKeyIssueEmitsMultipassAPIKeyV2 — same for the application key,
    including scopes.
  • TestAppKeyIssueOmitsScopesWhenProviderDidNotReport and
    TestAppKeyIssueCarriesReportedScopes — nil scopes are absent from the
    payload; reported scopes are carried through.
  • TestOrgAPIKeyBaseURLFollowsOverride — an issued key advertises the
    base-url override when one is configured.
  • TestOrgAPIKeyDescriptorDeclaresMultipassOutput — both descriptors declare
    the content type, display name, IsSecret and
    multipass.Tags(multipass.TypeAPIKeyV2).
  • pkg/multipass runs the copied package's own tests.

go build ./..., go vet ./..., go test ./... and golangci-lint run (CI's
v2.14.0) pass. There is no live-provider run here: the org key smoke test stays
opt-in (DATADOG_CREDENTIAL_SMOKE=1) and reads key_value rather than the raw
bytes.

Known CI

verify-versions-match fails because .versions.yaml on main pins baton-sdk
v0.43.0, and this branch needs the SDK commit that adds the credential-issue
output field. .versions.yaml is managed by baton-admin and edits to it are
rejected in PRs, so this branch cannot fix it. It clears once baton-sdk #1218
is released and baton-admin bumps the pinned SDK version.

highb and others added 2 commits November 3, 2026 19:36
The Datadog connector vended its org API key as the raw key bytes with no
schema, so the credential carried no declared type. Multipass needs
both: a type announced before the credential is minted, and a payload in
that type's shape afterwards.

The organization API key now returns an api_key payload whose value is
Multipass api_key_v2 JSON -- key_value, plus key_id, provider and
base_url where they apply -- and declares it on the issue descriptor
through the new CredentialIssueOptionDescriptor.output field. The MIME
type, its tags and the field name live in one place so the announcement
and the payload cannot disagree.

Service-account application keys are unchanged: they still return raw key
bytes with no schema.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Pins github.com/conductorone/baton-sdk to the IGA-5308 branch
pseudo-version, which adds CredentialIssueOptionDescriptor.output, and
re-vendors it. The dependency bump is required before the connector can
declare what an issued credential is, so it lands on its own.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@linear-code

linear-code Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

IGA-5308

IGA-5311

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit d40072a7a24a

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 3 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: full
View review run

Review Summary

Organization API key issuance now returns Multipass api_key_v2 JSON instead of the bare key. The JSON has key_value, key_id, provider, and base_url, where base_url is built as https://api.<site>. PlaintextData.Schema is set to the matching MIME type, and the org-key descriptor declares an Output field. A JSON encoding failure now also deletes the newly minted key, via the new discardOrganizationAPIKey helper. To get the descriptor output field, baton-sdk is repinned to a feature-branch pseudo-version and re-vendored.

I scanned the full PR diff, including go.mod, go.sum and the vendored SDK delta, for security and correctness. I applied the repo-local criteria:

  • Provisioning (PR1): I read the whole issuance flow.
  • Logging (L1/L6): the cleanup failure is logged at Warn and is a one-shot.
  • Error wrapping (E1–E3): checked.
  • Sync data loss (S): doesn't apply, because no List, Entitlements or Grants code changed.
  • Breaking changes (B): applied to the plaintext format change.

No security issues found. The plaintext isn't logged, and the encoding path fails closed and cleans up the key.

I did not review the vendored baton-sdk source line by line. I assessed it through the upstream compare v0.43.0...4c7962f2d9e5 (12 commits).

Security Issues

None found.

Correctness Issues

  • New go.mod:7: the baton-sdk pin v0.43.1-0.20261103192834-4c7962f2d9e5 is an unmerged feature-branch commit, 12 commits ahead of v0.43.0. Besides the output field (#1213/#1218), it includes SDK #1203 ("sync: require the page ledger and delete the token-checkpoint sync path") and #1202 (deletes the expand paths). That's why the vendored diff drops about 3.5k lines from pkg/sync, pkg/dotc1z/engine/pebble and pkg/synccompactor. Merging would ship unreleased sync-engine behavior that the PR doesn't describe. The PR body itself says not to merge yet. (Confidence: high)

Suggestions

  • New pkg/connector/users.go:308: the format of the issued org-key plaintext changes from raw key bytes to JSON, and nothing makes it opt-in (BP1/BP2). Any consumer that ignores Schema and treats the bytes as the key will break. Either confirm that every consumer honors the declared output or gate the change. (Confidence: medium)
  • New pkg/connector/users.go:298: base_url is always built from site, even when the base-url config override is set (connector.go points the official client at ddc.BaseUrl). In a proxied or overridden setup, the payload's endpoint differs from the one the connector actually calls. This may be intentional, but it's worth documenting. (Confidence: low)
  • New pkg/connector/credential_output.go:82: the doc comment says organizationAPIKeyOutput, but the function is named multipassAPIKeyV2Output. (Confidence: high, cosmetic)
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to feature-branch pseudo-version v0.43.1-0.20261103192834-4c7962f2d9e5. Besides the credential output field, it pulls in unreleased sync-engine changes: SDK #1203 requires the page ledger and deletes the token-checkpoint sync path, and #1202 deletes the expand paths. Once baton-sdk#1218 merges, repin to a tagged release that contains it, then run `go mod tidy && go mod vendor`. List any sync-path behavior changes that release brings in in the PR description.

## Suggestions

In `pkg/connector/users.go`:
- Around line 290-308: The org API key plaintext changed from raw key bytes to api_key_v2 JSON, and the change isn't opt-in. Confirm that every consumer of issued plaintext honors PlaintextData.Schema or the descriptor Output, and note this in the PR. If not, gate the JSON format behind a config option.
- Around line 298: base_url is always fmt.Sprintf(client.DefaultBaseURL, site), even when the base-url config override is set. Decide whether the override should be reflected, and document the choice in a comment.

In `pkg/connector/credential_output.go`:
- Around line 82: Rename the doc comment's subject from `organizationAPIKeyOutput` to `multipassAPIKeyV2Output` so it matches the function name.

Comment thread go.mod Outdated
require (
github.com/DataDog/datadog-api-client-go/v2 v2.43.0
github.com/conductorone/baton-sdk v0.43.0
github.com/conductorone/baton-sdk v0.43.1-0.20261103192834-4c7962f2d9e5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Bug: This pin isn't just v0.43.0 plus the output field. It's v0.43.0 plus 12 unreleased commits, including baton-sdk #1203 ("sync: require the page ledger and delete the token-checkpoint sync path") and #1202 (deletes the expand paths). That's why the vendored diff removes about 3.5k lines from pkg/sync and pkg/dotc1z/engine/pebble. The PR body doesn't mention any of this sync-engine change, and it points at an unmerged feature-branch commit. Repin to a tagged baton-sdk release that contains #1218, and call out any sync-path changes that release brings in. (Confidence: high)

Comment thread pkg/connector/users.go Outdated
PlaintextData: []*v2.PlaintextData{
v2.PlaintextData_builder{Name: "api_key", Bytes: []byte(key.Secret)}.Build(),
v2.PlaintextData_builder{
Name: datadogAPIKeyFieldName,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: The org API key plaintext used to be the bare key. Now it's JSON, and nothing makes that opt-in. Anything that reads the issued bytes as the key itself (reveal flows, automations, older C1 consumers that ignore Schema) will get {"key_value":...} instead. If every consumer already honors the declared output, say so in the PR. Otherwise, gate the change. (Confidence: medium)

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit ddd7cb184ee9

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 3 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: full
View review run

Review Summary

Organization API key issuance now returns Multipass api_key_v2 JSON instead of the bare key. The JSON has key_value, key_id, provider, and base_url, where base_url is built as https://api.<site>. PlaintextData.Schema is set to the matching MIME type, and the org-key descriptor declares an Output field. A JSON encoding failure now also deletes the newly minted key, via the new discardOrganizationAPIKey helper. To get the descriptor output field, baton-sdk is repinned to a feature-branch pseudo-version and re-vendored.

I scanned the full PR diff, including go.mod, go.sum and the vendored SDK delta, for security and correctness. I applied the repo-local criteria:

  • Provisioning (PR1): I read the whole issuance flow.
  • Logging (L1/L6): the cleanup failure is logged at Warn and is a one-shot.
  • Error wrapping (E1–E3): checked.
  • Sync data loss (S): doesn't apply, because no List, Entitlements or Grants code changed.
  • Breaking changes (B): applied to the plaintext format change.

No security issues found. The plaintext isn't logged, and the encoding path fails closed and cleans up the key.

I did not review the vendored baton-sdk source line by line. I assessed it through the upstream compare v0.43.0...4c7962f2d9e5 (12 commits).

Security Issues

None found.

Correctness Issues

  • New go.mod:7: the baton-sdk pin v0.43.1-0.20261103192834-4c7962f2d9e5 is an unmerged feature-branch commit, 12 commits ahead of v0.43.0. Besides the output field (#1213/#1218), it includes SDK #1203 ("sync: require the page ledger and delete the token-checkpoint sync path") and #1202 (deletes the expand paths). That's why the vendored diff drops about 3.5k lines from pkg/sync, pkg/dotc1z/engine/pebble and pkg/synccompactor. Merging would ship unreleased sync-engine behavior that the PR doesn't describe. The PR body itself says not to merge yet. (Confidence: high)

Suggestions

  • New pkg/connector/users.go:308: the format of the issued org-key plaintext changes from raw key bytes to JSON, and nothing makes it opt-in (BP1/BP2). Any consumer that ignores Schema and treats the bytes as the key will break. Either confirm that every consumer honors the declared output or gate the change. (Confidence: medium)
  • New pkg/connector/users.go:298: base_url is always built from site, even when the base-url config override is set (connector.go points the official client at ddc.BaseUrl). In a proxied or overridden setup, the payload's endpoint differs from the one the connector actually calls. This may be intentional, but it's worth documenting. (Confidence: low)
  • New pkg/connector/credential_output.go:82: the doc comment says organizationAPIKeyOutput, but the function is named multipassAPIKeyV2Output. (Confidence: high, cosmetic)
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to feature-branch pseudo-version v0.43.1-0.20261103192834-4c7962f2d9e5. Besides the credential output field, it pulls in unreleased sync-engine changes: SDK #1203 requires the page ledger and deletes the token-checkpoint sync path, and #1202 deletes the expand paths. Once baton-sdk#1218 merges, repin to a tagged release that contains it, then run `go mod tidy && go mod vendor`. List any sync-path behavior changes that release brings in in the PR description.

## Suggestions

In `pkg/connector/users.go`:
- Around line 290-308: The org API key plaintext changed from raw key bytes to api_key_v2 JSON, and the change isn't opt-in. Confirm that every consumer of issued plaintext honors PlaintextData.Schema or the descriptor Output, and note this in the PR. If not, gate the JSON format behind a config option.
- Around line 298: base_url is always fmt.Sprintf(client.DefaultBaseURL, site), even when the base-url config override is set. Decide whether the override should be reflected, and document the choice in a comment.

In `pkg/connector/credential_output.go`:
- Around line 82: Rename the doc comment's subject from `organizationAPIKeyOutput` to `multipassAPIKeyV2Output` so it matches the function name.

Reviewed commit: d40072a7a24a

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

highb and others added 2 commits November 3, 2026 19:41
baton-sdk now ships pkg/secret, so the connector does not need its own
api_key_v2 struct and constants. The organization API key builds
secret.APIKeyV2, encodes it with secret.Plaintext -- which sets the schema
from the same type id -- and declares the descriptor output with
secret.OutputField. The descriptor and the payload can no longer name
different types, because both are derived from secret.TypeAPIKeyV2.

The emitted JSON is unchanged: secret.APIKeyV2 carries the same field
names and omitempty tags as the struct this replaces. DisplayName stays on
the field.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Moves the pin to d483c04a, which carries the standard Multipass types in
pkg/secret that the previous commit uses, and re-vendors it.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit ddd7cb184ee9

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since d40072a
View review run

Review Summary

The new commits replace the connector-local Multipass constants, the payload struct and the encoder with baton-sdk's new pkg/secret:

  • organizationAPIKeyPayload builds a secret.APIKeyV2.
  • secret.Plaintext sets PlaintextData.Schema.
  • secret.OutputField builds the descriptor output.

The tests were updated to match, and the SDK pin moved to d483c04a2873. The connector no longer guards against an empty key_value itself, but nothing is lost: CreateAPIKey already rejects an empty key (pkg/client/client.go:207).

I scanned the full PR diff for security and correctness, including the dropped vendor/.../pkg/secret/* and vendor/modules.txt paths. I read the vendored secret package in full; it is a thin JSON/MIME helper with no validation, which matches its own doc.

Repo-local criteria were applied:

  • Breaking-change gate (BP1/BP2) and dependency checks: produced the findings below.
  • Logging (A), spans (C) and JSON types (D): no relevant changes.
  • Sync data loss (S): does not apply, because no List, Entitlements or Grants code changed.

Coverage gap: I did not review the vendored sync-engine drift (pkg/sync, pkg/dotc1z/engine/pebble, pkg/synccompactor) in depth. That drift is the subject of the blocking finding.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to an unreleased pseudo-version (v0.43.1-0.20261103193733-d483c04a2873). The vendor diff still carries the unrelated sync-engine changes in pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble and pkg/synccompactor. The PR body itself says not to merge before baton-sdk#1218 lands and the pin moves to a release. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:293: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, and nothing makes that opt-in (BP1/BP2). A consumer that ignores Schema will break. (Confidence: medium)
  • Prior — still present pkg/connector/users.go:296: base_url is always built from site through client.DefaultBaseURL. The base-url config override (connector.go:167) is ignored, so in a proxied or overridden setup the payload names a different endpoint from the one the connector calls. (Confidence: low)

Resolved prior findings

  • Doc comment / function name mismatch in credential_output.go: fixed. The function is now named organizationAPIKeyOutput, which matches its doc comment (pkg/connector/credential_output.go:61-65).
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103193733-d483c04a2873, which also pulls in unrelated sync-engine changes (pkg/sync, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 merges, repin to the tagged release that contains it, run `go mod tidy && go mod vendor`, and describe any sync-path behavior changes in the PR body.

## Suggestions

In `pkg/connector/users.go`:
- Around line 293: The issued org API key plaintext changed from the raw key to api_key_v2 JSON. Confirm that every consumer honors PlaintextData.Schema, or gate the new format behind a config option, and call out the format change in the PR description.
- Around line 296: base_url is always derived from site and ignores the base-url config override. Either use the effective base URL the client uses, or document why the payload deliberately advertises the public site endpoint.

Comment thread go.mod Outdated
require (
github.com/DataDog/datadog-api-client-go/v2 v2.43.0
github.com/conductorone/baton-sdk v0.43.0
github.com/conductorone/baton-sdk v0.43.1-0.20261103193733-d483c04a2873

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Bug: The new pin v0.43.1-0.20261103193733-d483c04a2873 is still an unreleased feature-branch commit. The vendor diff still carries the unrelated sync-engine changes: pkg/sync/*, pkg/sync/expand/*, pkg/dotc1z/engine/pebble/* and pkg/synccompactor/* (the ledger-only sync path from SDK #1203, plus the expand-path deletions). Before merging, repin to a tagged baton-sdk release that includes #1218, then run go mod tidy && go mod vendor. (Confidence: high)

Comment thread pkg/connector/users.go Outdated
// base_url is the endpoint the key authenticates against, built from the
// connector's configured site the way the REST client builds its own base
// URL -- not from whatever host a test server happens to use.
plaintext, err := organizationAPIKeyPlaintext(organizationAPIKeyPayload(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: The org API key plaintext used to be the bare key. Now it's api_key_v2 JSON, and that is not opt-in (BP1/BP2). A consumer that ignores PlaintextData.Schema and uses the bytes as the key will break. Either confirm that every reveal/consumer path honors the declared schema, or gate the format change. (Confidence: medium)

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 5003d05c3a48

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since d40072a
View review run

Review Summary

The new commits replace the connector-local Multipass constants, the payload struct and the encoder with baton-sdk's new pkg/secret:

  • organizationAPIKeyPayload builds a secret.APIKeyV2.
  • secret.Plaintext sets PlaintextData.Schema.
  • secret.OutputField builds the descriptor output.

The tests were updated to match, and the SDK pin moved to d483c04a2873. The connector no longer guards against an empty key_value itself, but nothing is lost: CreateAPIKey already rejects an empty key (pkg/client/client.go:207).

I scanned the full PR diff for security and correctness, including the dropped vendor/.../pkg/secret/* and vendor/modules.txt paths. I read the vendored secret package in full; it is a thin JSON/MIME helper with no validation, which matches its own doc.

Repo-local criteria were applied:

  • Breaking-change gate (BP1/BP2) and dependency checks: produced the findings below.
  • Logging (A), spans (C) and JSON types (D): no relevant changes.
  • Sync data loss (S): does not apply, because no List, Entitlements or Grants code changed.

Coverage gap: I did not review the vendored sync-engine drift (pkg/sync, pkg/dotc1z/engine/pebble, pkg/synccompactor) in depth. That drift is the subject of the blocking finding.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to an unreleased pseudo-version (v0.43.1-0.20261103193733-d483c04a2873). The vendor diff still carries the unrelated sync-engine changes in pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble and pkg/synccompactor. The PR body itself says not to merge before baton-sdk#1218 lands and the pin moves to a release. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:293: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, and nothing makes that opt-in (BP1/BP2). A consumer that ignores Schema will break. (Confidence: medium)
  • Prior — still present pkg/connector/users.go:296: base_url is always built from site through client.DefaultBaseURL. The base-url config override (connector.go:167) is ignored, so in a proxied or overridden setup the payload names a different endpoint from the one the connector calls. (Confidence: low)

Resolved prior findings

  • Doc comment / function name mismatch in credential_output.go: fixed. The function is now named organizationAPIKeyOutput, which matches its doc comment (pkg/connector/credential_output.go:61-65).
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103193733-d483c04a2873, which also pulls in unrelated sync-engine changes (pkg/sync, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 merges, repin to the tagged release that contains it, run `go mod tidy && go mod vendor`, and describe any sync-path behavior changes in the PR body.

## Suggestions

In `pkg/connector/users.go`:
- Around line 293: The issued org API key plaintext changed from the raw key to api_key_v2 JSON. Confirm that every consumer honors PlaintextData.Schema, or gate the new format behind a config option, and call out the format change in the PR description.
- Around line 296: base_url is always derived from site and ignores the base-url config override. Either use the effective base URL the client uses, or document why the payload deliberately advertises the public site endpoint.

Reviewed commit: ddd7cb184ee9

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

Moves the pin to the SDK head that adds one test-only lint suppression
after d483c04. No API change, so nothing but go.mod, go.sum and the
vendored version line moves.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 5003d05c3a48

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since ddd7cb18
View review run

Review Summary

The PR changes how Datadog organization API keys are issued. Instead of returning the bare key bytes, issuance now returns Multipass api_key_v2 JSON with a matching Schema, and the org-key descriptor declares that output. Both come from baton-sdk's pkg/secret (pkg/connector/credential_output.go, users.go:287-301).

The new commit only repins baton-sdk from d483c04a2873 to 101e5eed424c (go.mod, go.sum, vendor/modules.txt). No vendored source files changed between the two pins. vendor/modules.txt, which the incremental artifact dropped, was checked in the full diff: only the version line changed.

The full PR diff was scanned for security and correctness, including the vendored SDK paths. Repo-local criteria were applied:

  • S / L / T: S (sync data loss) does not apply, because no List, Entitlements or Grants code changed. No new logging or spans were added.
  • Provisioning / E: the issuance error paths wrap errors with %w and revoke the minted key on failure.
  • BP1-BP5: applied to the change in plaintext format.
  • Dependency checks: applied to the SDK pin.

The vendored SDK sync-engine drift was not reviewed line by line. The author states it is out of scope and will drop out when the pin moves to a release.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to an unreleased pseudo-version (v0.43.1-0.20261103194337-101e5eed424c).
    • The vendor diff still carries unrelated sync-engine changes in pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble and pkg/synccompactor.
    • The PR body itself says not to merge until baton-sdk#1218 lands and the pin moves to a release.
    • The earlier inline threads are outdated, so a fresh inline comment was posted. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:293: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, and nothing makes that opt-in (BP1/BP2). A consumer that ignores Schema will break. (Confidence: medium)
  • Prior — still present pkg/connector/users.go:296: base_url is always built as fmt.Sprintf(client.DefaultBaseURL, site). The base-url config override (pkg/config/config.go:70, honored in pkg/client/rest_client.go:97-100) is ignored. In an overridden or proxied setup, the payload names a different endpoint from the one the connector actually calls. (Confidence: low)
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c, which also pulls in unrelated sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 merges, repin to the tagged release that contains it, run `go mod tidy && go mod vendor`, and describe any sync-path behavior changes in the PR body.

## Suggestions

In `pkg/connector/users.go`:
- Around line 293: The org API key plaintext changed from the bare key to api_key_v2 JSON, and the change is not opt-in. Either gate it behind a config flag, or state the format change explicitly in the PR body and confirm that every consumer reads PlaintextData.Schema.
- Around line 296: base_url is always derived from the site via client.DefaultBaseURL, ignoring the `base-url` config override. Expose the effective base URL from the client (the one rest_client.go computes) and use it for the payload's base_url.

Comment thread go.mod Outdated
require (
github.com/DataDog/datadog-api-client-go/v2 v2.43.0
github.com/conductorone/baton-sdk v0.43.0
github.com/conductorone/baton-sdk v0.43.1-0.20261103194337-101e5eed424c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Bug: The repin to v0.43.1-0.20261103194337-101e5eed424c is still an unreleased pseudo-version. The vendor tree still carries the unrelated sync-engine changes (pkg/sync/*, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor), so merging now would ship unreleased SDK sync behavior. Repin to the tagged baton-sdk release that includes #1218, then run go mod tidy && go mod vendor. (Confidence: high)

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 0e29ec6ba426

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since ddd7cb18
View review run

Review Summary

The PR changes how Datadog organization API keys are issued. Instead of returning the bare key bytes, issuance now returns Multipass api_key_v2 JSON with a matching Schema, and the org-key descriptor declares that output. Both come from baton-sdk's pkg/secret (pkg/connector/credential_output.go, users.go:287-301).

The new commit only repins baton-sdk from d483c04a2873 to 101e5eed424c (go.mod, go.sum, vendor/modules.txt). No vendored source files changed between the two pins. vendor/modules.txt, which the incremental artifact dropped, was checked in the full diff: only the version line changed.

The full PR diff was scanned for security and correctness, including the vendored SDK paths. Repo-local criteria were applied:

  • S / L / T: S (sync data loss) does not apply, because no List, Entitlements or Grants code changed. No new logging or spans were added.
  • Provisioning / E: the issuance error paths wrap errors with %w and revoke the minted key on failure.
  • BP1-BP5: applied to the change in plaintext format.
  • Dependency checks: applied to the SDK pin.

The vendored SDK sync-engine drift was not reviewed line by line. The author states it is out of scope and will drop out when the pin moves to a release.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to an unreleased pseudo-version (v0.43.1-0.20261103194337-101e5eed424c).
    • The vendor diff still carries unrelated sync-engine changes in pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble and pkg/synccompactor.
    • The PR body itself says not to merge until baton-sdk#1218 lands and the pin moves to a release.
    • The earlier inline threads are outdated, so a fresh inline comment was posted. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:293: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, and nothing makes that opt-in (BP1/BP2). A consumer that ignores Schema will break. (Confidence: medium)
  • Prior — still present pkg/connector/users.go:296: base_url is always built as fmt.Sprintf(client.DefaultBaseURL, site). The base-url config override (pkg/config/config.go:70, honored in pkg/client/rest_client.go:97-100) is ignored. In an overridden or proxied setup, the payload names a different endpoint from the one the connector actually calls. (Confidence: low)
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c, which also pulls in unrelated sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 merges, repin to the tagged release that contains it, run `go mod tidy && go mod vendor`, and describe any sync-path behavior changes in the PR body.

## Suggestions

In `pkg/connector/users.go`:
- Around line 293: The org API key plaintext changed from the bare key to api_key_v2 JSON, and the change is not opt-in. Either gate it behind a config flag, or state the format change explicitly in the PR body and confirm that every consumer reads PlaintextData.Schema.
- Around line 296: base_url is always derived from the site via client.DefaultBaseURL, ignoring the `base-url` config override. Expose the effective base URL from the client (the one rest_client.go computes) and use it for the payload's base_url.

Reviewed commit: 5003d05c3a48

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 0e29ec6ba426

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 5003d05c
View review run

Review Summary

The new commit makes three changes. It regenerates baton_capabilities.json so that the org API key credential option now declares an output field (api_key, application/vnd.multipass.api_key_v2+json, tags credential/multipass/api_key_v2). That declaration matches organizationAPIKeyOutput() in pkg/connector/credential_output.go:65-69. It also documents the JSON delivery format in docs/connector.mdx and adds a gosec nolint on a display-name constant. None of these change runtime behavior.

I scanned the whole PR diff for security and correctness, including go.mod/go.sum. I reviewed the 82 vendored baton-sdk files only at the dependency level, not line by line.

I applied the repo-local criteria:

  • S / L / T / J: not triggered. No List/Entitlements/Grants code, logging, spans or response structs changed.
  • E: the issuance error paths wrap errors with %w and revoke the minted key on failure.
  • BP3: now met by the docs update.
  • BP1: still not met. The format change is not opt-in (see Suggestions).

The head SHA was re-confirmed as 0e29ec6b before posting.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c.
    • The vendor diff still carries unrelated sync-engine changes in pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble and pkg/synccompactor.
    • The PR body itself says not to merge until baton-sdk#1218 lands and the pin moves to a release.
    • The open inline thread at go.mod:7 still applies, so no new thread was posted. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:293: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, with no opt-in.
    • The format change is now documented in docs/connector.mdx, which satisfies BP3. It is still default-on (BP1).
    • A consumer that ignores PlaintextData.Schema and treats the bytes as the key will break.
    • The open thread still applies. (Confidence: medium)
  • Prior — still present pkg/connector/users.go:296: base_url is always built as fmt.Sprintf(client.DefaultBaseURL, site).
    • This ignores the base-url config override that pkg/client/rest_client.go:97-100 honors.
    • In an overridden or proxied setup, the payload therefore names a different endpoint from the one the connector actually calls. (Confidence: low)

Resolved prior findings

  • The outdated go.mod threads (pins 4c7962f2d9e5 and d483c04a2873) and the outdated users.go plaintext-format thread describe the same issues as the active items above. They are counted once there and are not fixed. Thread auto-resolution is blocked in this repo.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c. That pin also pulls in unrelated sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 merges, repin to the tagged release that contains it, run `go mod tidy && go mod vendor`, and describe any sync-path behavior changes in the PR body.

## Suggestions

In `pkg/connector/users.go`:
- Around line 293: org API key plaintext changes from bare key bytes to api_key_v2 JSON with no opt-in. Either gate the new format behind a config flag, or confirm in the PR body that every downstream consumer reads PlaintextData.Schema before using the bytes.
- Around line 296: base_url is always derived from the site via client.DefaultBaseURL, ignoring the `base-url` config override. Expose the effective base URL from the client (the value rest_client.go computes) and use it for the payload's base_url.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit c47fb058f27b

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 5003d05c
View review run

Review Summary

The new commit makes three changes. It regenerates baton_capabilities.json so that the org API key credential option now declares an output field (api_key, application/vnd.multipass.api_key_v2+json, tags credential/multipass/api_key_v2). That declaration matches organizationAPIKeyOutput() in pkg/connector/credential_output.go:65-69. It also documents the JSON delivery format in docs/connector.mdx and adds a gosec nolint on a display-name constant. None of these change runtime behavior.

I scanned the whole PR diff for security and correctness, including go.mod/go.sum. I reviewed the 82 vendored baton-sdk files only at the dependency level, not line by line.

I applied the repo-local criteria:

  • S / L / T / J: not triggered. No List/Entitlements/Grants code, logging, spans or response structs changed.
  • E: the issuance error paths wrap errors with %w and revoke the minted key on failure.
  • BP3: now met by the docs update.
  • BP1: still not met. The format change is not opt-in (see Suggestions).

The head SHA was re-confirmed as 0e29ec6b before posting.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c.
    • The vendor diff still carries unrelated sync-engine changes in pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble and pkg/synccompactor.
    • The PR body itself says not to merge until baton-sdk#1218 lands and the pin moves to a release.
    • The open inline thread at go.mod:7 still applies, so no new thread was posted. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:293: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, with no opt-in.
    • The format change is now documented in docs/connector.mdx, which satisfies BP3. It is still default-on (BP1).
    • A consumer that ignores PlaintextData.Schema and treats the bytes as the key will break.
    • The open thread still applies. (Confidence: medium)
  • Prior — still present pkg/connector/users.go:296: base_url is always built as fmt.Sprintf(client.DefaultBaseURL, site).
    • This ignores the base-url config override that pkg/client/rest_client.go:97-100 honors.
    • In an overridden or proxied setup, the payload therefore names a different endpoint from the one the connector actually calls. (Confidence: low)

Resolved prior findings

  • The outdated go.mod threads (pins 4c7962f2d9e5 and d483c04a2873) and the outdated users.go plaintext-format thread describe the same issues as the active items above. They are counted once there and are not fixed. Thread auto-resolution is blocked in this repo.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c. That pin also pulls in unrelated sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 merges, repin to the tagged release that contains it, run `go mod tidy && go mod vendor`, and describe any sync-path behavior changes in the PR body.

## Suggestions

In `pkg/connector/users.go`:
- Around line 293: org API key plaintext changes from bare key bytes to api_key_v2 JSON with no opt-in. Either gate the new format behind a config flag, or confirm in the PR body that every downstream consumer reads PlaintextData.Schema before using the bytes.
- Around line 296: base_url is always derived from the site via client.DefaultBaseURL, ignoring the `base-url` config override. Expose the effective base URL from the client (the value rest_client.go computes) and use it for the payload's base_url.

Reviewed commit: 0e29ec6ba426

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

highb and others added 2 commits November 3, 2026 20:05
gosec reads a string containing "API key" as a possible credential. This
one is the label C1 shows for the field, not a secret, so the finding is
suppressed on that line alone. CI pointed at line 24; gosec flags the
display name there, not the field name, so the suppression sits on the
line the linter actually reports -- an unused nolint is itself a failure.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
The new credential descriptor Output changes the connector's generated
capabilities, so baton_capabilities.json is regenerated from the binary.
config_schema.json is unchanged but regenerated alongside it, as the
metadata workflow does.

docs/connector.mdx describes what the issued organization API key now
looks like, since the delivery format is what a caller handling the key
needs to know.

Generated with:
  go build -o connector ./cmd/baton-datadog
  ./connector capabilities > baton_capabilities.json
  ./connector config > config_schema.json

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@highb
highb force-pushed the highb/IGA-5308/emit-multipass-api-key-v2-json branch from 0e29ec6 to c47fb05 Compare November 3, 2026 20:05
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit c47fb058f27b

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: full
View review run

Review Summary

Issuing a Datadog organization API key now returns secret.APIKeyV2 JSON instead of the bare key. The JSON carries key_value, key_id, provider=datadog and base_url=https://api.<site>, and PlaintextData.Schema is set to application/vnd.multipass.api_key_v2+json. The org-key descriptor declares a matching Output field. Both the schema and the output field come from the new baton-sdk pkg/secret package. If encoding fails after the key is minted, the new discardOrganizationAPIKey helper revokes the key. The service-account application key path is unchanged.

I scanned the full PR diff for security and correctness, including go.mod/go.sum and the 82 vendored baton-sdk files (2.4k lines added, 3.8k removed). The vendored files got a dependency-level check, not a line-by-line review.

How the repo-local criteria applied:

  • S, L, T, J: not triggered. No List/Entitlements/Grants code, spans, log levels on sync paths, or response structs changed.
  • E: the new error path uses %w and revokes the minted key.
  • E (BP1–BP3): applied to the plaintext format change (see Suggestions). docs/connector.mdx now documents the new format.
  • PR1–PR3: not applicable. There are no Grant/Revoke changes.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c. vendor/modules.txt:281 confirms the pin.
    • The vendor tree still carries unrelated sync-engine changes in pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble and pkg/synccompactor.
    • The PR body itself says not to merge until baton-sdk#1218 lands and the pin moves to a release.
    • The open inline thread at go.mod:7 covers this, so no new thread was posted. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:293: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, and the change is default-on with no opt-in (BP1). It is now documented, which satisfies BP3. A consumer that ignores PlaintextData.Schema and uses the bytes as the key will break. An open thread already covers this. (Confidence: medium)
  • Prior — still present pkg/connector/users.go:296: base_url is always built as fmt.Sprintf(client.DefaultBaseURL, site).
    • When base-url is set, pkg/connector/connector.go:192-198 points the official client that mints the key at the override instead.
    • In that case the payload names a different endpoint from the one that issued the key.
    • The override is hidden and CLI-only, so this only affects test setups.
    • This was raised only in earlier summaries with no inline thread, so an inline comment was posted this run. (Confidence: medium)

The outdated go.mod threads (pins 4c7962f2d9e5 and d483c04a2873) and the outdated users.go plaintext-format thread describe the same issues as the items above. They are counted once there and are not fixed. This repo blocks thread auto-resolution.

Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c. The pin also pulls in unrelated sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 merges, repin to the tagged release that contains it, run `go mod tidy && go mod vendor`, and describe any sync-path behavior changes in the PR body.

## Suggestions

In `pkg/connector/users.go`:
- Around line 293: The org API key plaintext changes from the bare key to api_key_v2 JSON by default. Either gate the new format behind opt-in config, or confirm that every consumer reads PlaintextData.Schema, and state the compatibility impact in the PR description.
- Around line 296: base_url is always derived from the site via client.DefaultBaseURL, which ignores the `base-url` override that connector.go applies to the official client. Store the effective base URL on DatadogClient (the override if set, otherwise https://api.<site>) and use it for the payload's base_url.

Comment thread pkg/connector/users.go Outdated
plaintext, err := organizationAPIKeyPlaintext(organizationAPIKeyPayload(
key.Secret,
key.ID,
fmt.Sprintf(client.DefaultBaseURL, u.wrapper.GetSite()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: base_url is always https://api.<site>, but when base-url is set, connector.go:192-198 points the official client (the one that mints this key) at that override instead. In that case the payload names a different endpoint from the one that issued the key. The override is hidden and CLI-only, so this only affects test setups. Pass the effective base URL through the wrapper rather than re-deriving it from the site. (Confidence: medium)

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 4c1284cf1a28

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: full
View review run

Review Summary

Issuing a Datadog organization API key now returns secret.APIKeyV2 JSON instead of the bare key. The JSON carries key_value, key_id, provider=datadog and base_url=https://api.<site>, and PlaintextData.Schema is set to application/vnd.multipass.api_key_v2+json. The org-key descriptor declares a matching Output field. Both the schema and the output field come from the new baton-sdk pkg/secret package. If encoding fails after the key is minted, the new discardOrganizationAPIKey helper revokes the key. The service-account application key path is unchanged.

I scanned the full PR diff for security and correctness, including go.mod/go.sum and the 82 vendored baton-sdk files (2.4k lines added, 3.8k removed). The vendored files got a dependency-level check, not a line-by-line review.

How the repo-local criteria applied:

  • S, L, T, J: not triggered. No List/Entitlements/Grants code, spans, log levels on sync paths, or response structs changed.
  • E: the new error path uses %w and revokes the minted key.
  • E (BP1–BP3): applied to the plaintext format change (see Suggestions). docs/connector.mdx now documents the new format.
  • PR1–PR3: not applicable. There are no Grant/Revoke changes.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c. vendor/modules.txt:281 confirms the pin.
    • The vendor tree still carries unrelated sync-engine changes in pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble and pkg/synccompactor.
    • The PR body itself says not to merge until baton-sdk#1218 lands and the pin moves to a release.
    • The open inline thread at go.mod:7 covers this, so no new thread was posted. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:293: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, and the change is default-on with no opt-in (BP1). It is now documented, which satisfies BP3. A consumer that ignores PlaintextData.Schema and uses the bytes as the key will break. An open thread already covers this. (Confidence: medium)
  • Prior — still present pkg/connector/users.go:296: base_url is always built as fmt.Sprintf(client.DefaultBaseURL, site).
    • When base-url is set, pkg/connector/connector.go:192-198 points the official client that mints the key at the override instead.
    • In that case the payload names a different endpoint from the one that issued the key.
    • The override is hidden and CLI-only, so this only affects test setups.
    • This was raised only in earlier summaries with no inline thread, so an inline comment was posted this run. (Confidence: medium)

The outdated go.mod threads (pins 4c7962f2d9e5 and d483c04a2873) and the outdated users.go plaintext-format thread describe the same issues as the items above. They are counted once there and are not fixed. This repo blocks thread auto-resolution.

Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103194337-101e5eed424c. The pin also pulls in unrelated sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 merges, repin to the tagged release that contains it, run `go mod tidy && go mod vendor`, and describe any sync-path behavior changes in the PR body.

## Suggestions

In `pkg/connector/users.go`:
- Around line 293: The org API key plaintext changes from the bare key to api_key_v2 JSON by default. Either gate the new format behind opt-in config, or confirm that every consumer reads PlaintextData.Schema, and state the compatibility impact in the PR description.
- Around line 296: base_url is always derived from the site via client.DefaultBaseURL, which ignores the `base-url` override that connector.go applies to the official client. Store the effective base URL on DatadogClient (the override if set, otherwise https://api.<site>) and use it for the payload's base_url.

Reviewed commit: c47fb058f27b

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit d742238c49ee

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 3 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 0ad3e42
View review run

Review Summary

The new commit moves baton-sdk from 63637fd8fa36 to 61f186d39069 and re-vendors it. In the SDK:

  • secret.OutputField now sets an empty StringField on the output descriptor, which is why baton_capabilities.json gains "stringField": {}.
  • The unused TypeHOTP/TypeNote/TypeGeneric constants are removed. The connector never references them.
  • The connector.pb.go changes only touch comments.

I scanned the full PR diff for security and correctness, including go.mod/go.sum and the five vendored paths the incremental artifact dropped (pb/.../connector*.pb.go, pkg/secret/{encode,typeids}.go, vendor/modules.txt). I applied the repo-local criteria:

  • The E/R4 wrapping and the BP gate apply. The org key arm wraps encode errors with %w and still revokes the minted key on failure.
  • S/L/T/J don't apply here: no List/Entitlements/Grants, log-level, span or response-struct code changed.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103202556-61f186d39069 (vendor/modules.txt:281). The vendor tree still carries unrelated sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). The PR body itself says not to merge until baton-sdk#1218 is released. Every earlier go.mod thread went outdated, so I posted one fresh inline comment. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:290: the org-key plaintext changes from raw key bytes to api_key_v2 JSON, and the change is on by default with no opt-in (BP1). The PR body and docs/connector.mdx cover BP2/BP3. A consumer that ignores PlaintextData.Schema will still get JSON instead of the key. The open thread covers this. (Confidence: medium)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the opt-in live smoke test passes the fixture testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)
  • Prior — still present pkg/connector/credential_output_test.go:80: the test only asserts that values are non-null. Nothing checks that an empty KeyID/BaseURL is left out rather than emitted as "", so that behavior depends entirely on the SDK's omitempty tags. (Confidence: low)
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.43.1-0.20261103202556-61f186d39069, which also vendors unrelated sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). Once baton-sdk#1218 is released, repin to that tag and run `go mod tidy && go mod vendor`.

## Suggestions

In `pkg/connector/users.go`:
- Around line 290: the org API key plaintext is now api_key_v2 JSON by default. Either gate it behind an opt-in config flag (BP1) or confirm that every consumer honors PlaintextData.Schema.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint. Optionally assert that the payload's base_url matches it.

In `pkg/connector/credential_output_test.go`:
- Around line 80: add a test that issues an org key whose create response has an empty id, built with an empty apiBaseURL. Assert that the emitted JSON leaves out `key_id` and `base_url` entirely rather than emitting "".

Reviewed commit: 8a9867dfa044

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

highb and others added 2 commits November 4, 2026 00:09
baton-multipass-sdk cannot be published until it is public, so the shared
Multipass types are vendored by copying them. Every file is byte-identical
to the source at b9f4b677 apart from the provenance header, and the package
keeps its name and its exported API, so replacing this directory with a
module dependency later is an import-path change only.

Copied from github.com/conductorone/baton-multipass-sdk/pkg/multipass at
b9f4b6776da475759bbcdc18f8209fedab389a6c, tests included.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
The four connector files import baton-datadog/pkg/multipass instead of
baton-sdk/pkg/secret, which the shrunken SDK no longer carries.

61f186d3 was the only baton-sdk commit carrying pkg/secret, so it is
orphaned; this pins the shrunken #1218 (dc065ae5) instead. The pinned
pseudo-version is v0.44.1-0.20261103220501-dc065ae56b48: v0.44.0 is the
commit those changes sit on, so v0.44.1 is the correct base.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit d742238c49ee

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 3 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 8a9867d
View review run

Review Summary

This PR changes how Datadog organization API keys are issued: the plaintext is now Multipass api_key_v2 JSON (key_value, key_id, provider, base_url), and the org-key descriptor declares that output type. The new commits do two things:

  • They move the Multipass types out of the vendored baton-sdk pkg/secret and into a local copy at pkg/multipass/ (encode, decode, typeids, types, plus their tests). Every caller (users.go, credential_output.go, the tests) now imports pkg/multipass.
  • They repin baton-sdk to v0.44.1-0.20261103220501-dc065ae56b48, which no longer vendors pkg/secret. No source file still imports it.

I scanned the full PR diff for security and correctness, including the dropped vendor/modules.txt and pkg/secret/doc.go paths. Those only reflect the repin and the removed package.

How the trusted criteria applied:

  • E/R4: the org-key arm wraps the encode error with %w and revokes the minted key if encoding fails.
  • BP: applies to the plaintext format change (see Suggestions).
  • S/L/T/J/PR: don't apply, because no List/Entitlements/Grants, logging, span, API-response-struct or Grant/Revoke code changed.

Coverage gap: I did not review the ~100 upstream baton-sdk files under vendor/ line by line. They are covered as a whole by the go.mod finding below.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged #1218 branch. Compared with main (v0.43.0), the vendor tree also carries upstream sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). The PR body itself says not to merge before #1218 is released. Every earlier go.mod thread is outdated, so I posted one fresh inline comment. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:290: the org-key plaintext changes from the bare key to api_key_v2 JSON, and the change is on by default with no opt-in (BP1). The PR body and docs cover BP2/BP3, but a consumer that ignores PlaintextData.Schema (paper-vault until IGA-5311) gets JSON instead of the key. The earlier threads are all outdated, so I posted one fresh inline comment. (Confidence: medium)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the opt-in live smoke test still builds its issuer with the fixture testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)
  • New pkg/multipass/*.go:2: all 7 copied files carry the header Replace with that module once it is public (<TICKET>). The literal <TICKET> placeholder was never filled in, so nothing tracks swapping the copy for the real module. (Confidence: high)

Resolved prior findings

  • base_url ignoring the base-url override (two users.go threads): fixed. connector.go:51-56 apiBaseURL() returns the override when one is set, and that value reaches users.go:291 through connector.go:68.
  • No test that empty KeyID/BaseURL are left out (summary-only item): fixed. The omitempty tags now live in the repo's own pkg/multipass/types.go, and the api_key_v2 required only case in pkg/multipass/encode_test.go (TestJSONKeys) pins {"key_value":"dd-key"}.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor`, so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around line 287-296: org API key plaintext is now api_key_v2 JSON by default, where it used to be the bare key. Either put the new format behind an opt-in config flag (BP1), or record explicit sign-off that defaulting it on is intended for every delivery target.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint, and optionally assert that apiKeyPayload.BaseURL equals it.

In `pkg/multipass/{decode,decode_test,doc,encode,encode_test,typeids,types}.go`:
- Around line 2: replace the `<TICKET>` placeholder in the "Replace with that module once it is public" header with the real tracking ticket.

Comment thread go.mod
require (
github.com/DataDog/datadog-api-client-go/v2 v2.43.0
github.com/conductorone/baton-sdk v0.43.0
github.com/conductorone/baton-sdk v0.44.1-0.20261103220501-dc065ae56b48

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Bug: baton-sdk is still pinned to a pseudo-version, v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged #1218 branch. Compared with main (v0.43.0), the vendor tree also brings in upstream sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor) that this PR doesn't use. The PR body itself says not to merge until #1218 is released, so repin to that release and re-vendor. (Confidence: high)

Comment thread pkg/connector/users.go
return nil, fmt.Errorf("baton-datadog: build organization API key secret resource: %w", err)
}
// Multipass rejects nulls, so the optional api_key_v2 fields use omitempty.
plaintext, err := multipass.Plaintext(datadogAPIKeyFieldName, multipass.APIKeyV2{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: The org API key plaintext used to be the bare key. It is now api_key_v2 JSON, and this is on by default with no opt-in (BP1). The PR body and docs describe the change (BP2/BP3), but anything that ignores PlaintextData.Schema, including paper-vault deliveries until IGA-5311, will get JSON where it expected the key. Consider a config flag, or get explicit sign-off that defaulting this on is intended. (Confidence: medium)

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit a928a4f0d80b

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 3 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 8a9867d
View review run

Review Summary

This PR changes how Datadog organization API keys are issued: the plaintext is now Multipass api_key_v2 JSON (key_value, key_id, provider, base_url), and the org-key descriptor declares that output type. The new commits do two things:

  • They move the Multipass types out of the vendored baton-sdk pkg/secret and into a local copy at pkg/multipass/ (encode, decode, typeids, types, plus their tests). Every caller (users.go, credential_output.go, the tests) now imports pkg/multipass.
  • They repin baton-sdk to v0.44.1-0.20261103220501-dc065ae56b48, which no longer vendors pkg/secret. No source file still imports it.

I scanned the full PR diff for security and correctness, including the dropped vendor/modules.txt and pkg/secret/doc.go paths. Those only reflect the repin and the removed package.

How the trusted criteria applied:

  • E/R4: the org-key arm wraps the encode error with %w and revokes the minted key if encoding fails.
  • BP: applies to the plaintext format change (see Suggestions).
  • S/L/T/J/PR: don't apply, because no List/Entitlements/Grants, logging, span, API-response-struct or Grant/Revoke code changed.

Coverage gap: I did not review the ~100 upstream baton-sdk files under vendor/ line by line. They are covered as a whole by the go.mod finding below.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged #1218 branch. Compared with main (v0.43.0), the vendor tree also carries upstream sync-engine changes (pkg/sync, pkg/sync/expand, pkg/dotc1z/engine/pebble, pkg/synccompactor). The PR body itself says not to merge before #1218 is released. Every earlier go.mod thread is outdated, so I posted one fresh inline comment. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:290: the org-key plaintext changes from the bare key to api_key_v2 JSON, and the change is on by default with no opt-in (BP1). The PR body and docs cover BP2/BP3, but a consumer that ignores PlaintextData.Schema (paper-vault until IGA-5311) gets JSON instead of the key. The earlier threads are all outdated, so I posted one fresh inline comment. (Confidence: medium)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the opt-in live smoke test still builds its issuer with the fixture testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)
  • New pkg/multipass/*.go:2: all 7 copied files carry the header Replace with that module once it is public (<TICKET>). The literal <TICKET> placeholder was never filled in, so nothing tracks swapping the copy for the real module. (Confidence: high)

Resolved prior findings

  • base_url ignoring the base-url override (two users.go threads): fixed. connector.go:51-56 apiBaseURL() returns the override when one is set, and that value reaches users.go:291 through connector.go:68.
  • No test that empty KeyID/BaseURL are left out (summary-only item): fixed. The omitempty tags now live in the repo's own pkg/multipass/types.go, and the api_key_v2 required only case in pkg/multipass/encode_test.go (TestJSONKeys) pins {"key_value":"dd-key"}.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor`, so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around line 287-296: org API key plaintext is now api_key_v2 JSON by default, where it used to be the bare key. Either put the new format behind an opt-in config flag (BP1), or record explicit sign-off that defaulting it on is intended for every delivery target.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint, and optionally assert that apiKeyPayload.BaseURL equals it.

In `pkg/multipass/{decode,decode_test,doc,encode,encode_test,typeids,types}.go`:
- Around line 2: replace the `<TICKET>` placeholder in the "Replace with that module once it is public" header with the real tracking ticket.

Reviewed commit: d742238c49ee

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

baton-multipass-sdk tagged v0.0.1 at b9f4b677, the revision copied here, so
the header names the tag as well as the commit, and names IGA-5320 as the
ticket that swaps the copy for the real module.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit a928a4f0d80b

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since d742238
View review run

Review Summary

The PR issues Datadog organization API keys as Multipass api_key_v2 JSON, using types from a local copy of the private baton-multipass-sdk in pkg/multipass/. It also repins baton-sdk to get the descriptor output field.

The new commit (a928a4f) only changes comments. The two-line copy header in all 7 pkg/multipass/*.go files now names v0.0.1 (b9f4b677) and the replacement ticket IGA-5320. No code or behavior changed.

I scanned the full PR diff for security and correctness and re-checked every prior thread against the current code. The incremental artifact was complete (nothing dropped or truncated). Vendored baton-sdk content was not reviewed in bulk; it comes from the unchanged pin covered below.

Repo-local criteria applied:

  • E/R4: the org-key encode error is wrapped with %w, and the minted key is revoked on failure (users.go:296-299).
  • BP1–BP5: apply to the default-on plaintext format change (see Suggestions).
  • S/L/T/J/PR: don't apply. No List/Entitlements/Grants, logging, span, API-response-struct or Grant/Revoke code changed.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged baton-sdk#1218 branch. The vendor tree also carries upstream sync-engine changes this PR doesn't describe. The PR body itself says not to merge before #1218 is released. The open go.mod:7 thread covers this, so I posted no new inline comment. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:290: the org-key plaintext changes from the bare key to api_key_v2 JSON, and the change is on by default with no opt-in (BP1). The PR body and docs cover BP2/BP3. Until IGA-5311 ships, a consumer that ignores PlaintextData.Schema (paper-vault) gets JSON instead of the key. The open thread covers this. (Confidence: medium)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the opt-in live smoke test still passes the fixture testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)

Resolved prior findings

  • The <TICKET> placeholder in the pkg/multipass/*.go copy headers (summary-only finding) is fixed. All 7 files now name IGA-5320 at line 2, and no <TICKET> remains under pkg/.
  • The two older base_url threads on users.go (prior-10 and prior-11) stay fixed: users.go:294 uses u.apiBaseURL, which is the override-aware apiBaseURL() from connector.go.
  • The 6 outdated go.mod threads and the 3 outdated BP1 threads on users.go describe the same issues as the active items above, so each is counted once.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor`, so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around line 290: the org API key plaintext is now api_key_v2 JSON by default. Either gate it behind an opt-in config flag, or confirm that every consumer reads PlaintextData.Schema (IGA-5311) before release.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint, and optionally assert that apiKeyPayload.BaseURL equals it.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 76a5019bf832

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since d742238
View review run

Review Summary

The PR issues Datadog organization API keys as Multipass api_key_v2 JSON, using types from a local copy of the private baton-multipass-sdk in pkg/multipass/. It also repins baton-sdk to get the descriptor output field.

The new commit (a928a4f) only changes comments. The two-line copy header in all 7 pkg/multipass/*.go files now names v0.0.1 (b9f4b677) and the replacement ticket IGA-5320. No code or behavior changed.

I scanned the full PR diff for security and correctness and re-checked every prior thread against the current code. The incremental artifact was complete (nothing dropped or truncated). Vendored baton-sdk content was not reviewed in bulk; it comes from the unchanged pin covered below.

Repo-local criteria applied:

  • E/R4: the org-key encode error is wrapped with %w, and the minted key is revoked on failure (users.go:296-299).
  • BP1–BP5: apply to the default-on plaintext format change (see Suggestions).
  • S/L/T/J/PR: don't apply. No List/Entitlements/Grants, logging, span, API-response-struct or Grant/Revoke code changed.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged baton-sdk#1218 branch. The vendor tree also carries upstream sync-engine changes this PR doesn't describe. The PR body itself says not to merge before #1218 is released. The open go.mod:7 thread covers this, so I posted no new inline comment. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:290: the org-key plaintext changes from the bare key to api_key_v2 JSON, and the change is on by default with no opt-in (BP1). The PR body and docs cover BP2/BP3. Until IGA-5311 ships, a consumer that ignores PlaintextData.Schema (paper-vault) gets JSON instead of the key. The open thread covers this. (Confidence: medium)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the opt-in live smoke test still passes the fixture testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)

Resolved prior findings

  • The <TICKET> placeholder in the pkg/multipass/*.go copy headers (summary-only finding) is fixed. All 7 files now name IGA-5320 at line 2, and no <TICKET> remains under pkg/.
  • The two older base_url threads on users.go (prior-10 and prior-11) stay fixed: users.go:294 uses u.apiBaseURL, which is the override-aware apiBaseURL() from connector.go.
  • The 6 outdated go.mod threads and the 3 outdated BP1 threads on users.go describe the same issues as the active items above, so each is counted once.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor`, so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around line 290: the org API key plaintext is now api_key_v2 JSON by default. Either gate it behind an opt-in config flag, or confirm that every consumer reads PlaintextData.Schema (IGA-5311) before release.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint, and optionally assert that apiKeyPayload.BaseURL equals it.

Reviewed commit: a928a4f0d80b

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

The two header lines are now exactly the specified text, with the source,
tag and commit on one line rather than wrapped.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 76a5019bf832

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since a928a4f
View review run

Review Summary

The PR switches Datadog organization API key issuance to Multipass api_key_v2 JSON (key_value, key_id, provider, base_url) with a matching PlaintextData.Schema and descriptor output. It uses a vendored copy of pkg/multipass and a baton-sdk pseudo-version pin. The new commit (76a5019) only reflows the two-line copy header in all 7 pkg/multipass/*.go files. The source location stays on line 1 and the IGA-5320 note on line 2, and nothing functional changed. The full PR diff was scanned again for security and correctness, with no new issues. The repo-local criteria were applied: E/R4 still holds (encode errors are wrapped with %w, and the minted key is revoked on failure at users.go:296-299). BP1/BP5 applies to the plaintext format change (see Suggestions). S/L/T/J/PR don't apply, because no List/Entitlements/Grants, logging, span, API-response struct or Grant/Revoke code changed. The incremental artifact was complete (not partial, no dropped paths). Vendored baton-sdk content was assessed at the dependency-pin level, not line by line.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged baton-sdk#1218 branch. Compared with main (v0.43.0), the vendor tree also carries upstream sync-engine changes this PR doesn't describe. The PR body itself says not to merge before #1218 is released. The open go.mod:7 thread covers this, so I posted no new inline comment. The 6 outdated go.mod threads describe the same issue and are counted once. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:290: the org-key plaintext changes from the bare key to api_key_v2 JSON, and the change is on by default with no opt-in (BP1). The PR body and docs cover BP2/BP3. Until IGA-5311 ships, a consumer that ignores PlaintextData.Schema (such as paper-vault) gets JSON instead of the key. The open thread covers this, and the 3 outdated BP1 threads on users.go are counted with it. (Confidence: medium)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the opt-in live smoke test still passes the fixture testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)

Resolved prior findings

  • The two older base_url threads on users.go (prior-10 and prior-11) stay fixed: users.go:294 uses u.apiBaseURL, which is the override-aware apiBaseURL() value.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor`, so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around line 290: the org API key plaintext is now api_key_v2 JSON by default. Either gate it behind an opt-in config flag, or confirm that every consumer of PlaintextData reads Schema (including paper-vault before IGA-5311) before this is merged.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint, and optionally assert that the payload's BaseURL equals it.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 2d42b48da93c

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since a928a4f
View review run

Review Summary

The PR switches Datadog organization API key issuance to Multipass api_key_v2 JSON (key_value, key_id, provider, base_url) with a matching PlaintextData.Schema and descriptor output. It uses a vendored copy of pkg/multipass and a baton-sdk pseudo-version pin. The new commit (76a5019) only reflows the two-line copy header in all 7 pkg/multipass/*.go files. The source location stays on line 1 and the IGA-5320 note on line 2, and nothing functional changed. The full PR diff was scanned again for security and correctness, with no new issues. The repo-local criteria were applied: E/R4 still holds (encode errors are wrapped with %w, and the minted key is revoked on failure at users.go:296-299). BP1/BP5 applies to the plaintext format change (see Suggestions). S/L/T/J/PR don't apply, because no List/Entitlements/Grants, logging, span, API-response struct or Grant/Revoke code changed. The incremental artifact was complete (not partial, no dropped paths). Vendored baton-sdk content was assessed at the dependency-pin level, not line by line.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged baton-sdk#1218 branch. Compared with main (v0.43.0), the vendor tree also carries upstream sync-engine changes this PR doesn't describe. The PR body itself says not to merge before #1218 is released. The open go.mod:7 thread covers this, so I posted no new inline comment. The 6 outdated go.mod threads describe the same issue and are counted once. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:290: the org-key plaintext changes from the bare key to api_key_v2 JSON, and the change is on by default with no opt-in (BP1). The PR body and docs cover BP2/BP3. Until IGA-5311 ships, a consumer that ignores PlaintextData.Schema (such as paper-vault) gets JSON instead of the key. The open thread covers this, and the 3 outdated BP1 threads on users.go are counted with it. (Confidence: medium)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the opt-in live smoke test still passes the fixture testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)

Resolved prior findings

  • The two older base_url threads on users.go (prior-10 and prior-11) stay fixed: users.go:294 uses u.apiBaseURL, which is the override-aware apiBaseURL() value.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor`, so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around line 290: the org API key plaintext is now api_key_v2 JSON by default. Either gate it behind an opt-in config flag, or confirm that every consumer of PlaintextData reads Schema (including paper-vault before IGA-5311) before this is merged.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint, and optionally assert that the payload's BaseURL equals it.

Reviewed commit: 76a5019bf832

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

highb and others added 2 commits November 4, 2026 00:37
The application key now comes back as Multipass api_key_v2 JSON, the same
shape as the organization key, so both issuance kinds deliver typed
credentials instead of one typed and one bare.

It carries the header the key is sent in and the scopes Datadog reported;
nil scopes (the provider said nothing) are omitted rather than emitted as
an empty list, which would assert the key is unscoped. Encoding failures
revoke the key through the new discardServiceAccountApplicationKey, beside
the organization key's equivalent.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
The application key descriptor now declares its output, so the generated
capabilities gain that block.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 2d42b48da93c

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 5 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 76a5019
View review run

Review Summary

The new commits extend the Multipass change to service-account application keys:

  • issueServiceAccountApplicationKey now emits api_key_v2 JSON with header_name: DD-APPLICATION-KEY and the reported scopes.
  • The app-key descriptor declares an output field, and baton_capabilities.json is regenerated to match.
  • The org key gains header_name: DD-API-KEY.
  • App-key cleanup moves into a new discardServiceAccountApplicationKey helper.

I scanned the full PR diff for security and correctness, including the vendored baton-sdk pin through go.mod/vendor/modules.txt; I did not review the vendor tree's content line by line. I applied the repo-local criteria:

  • BP1–BP3 to the plaintext format change, now including the default app-key kind.
  • E1/L1 to the new cleanup helper: the Warn level for a failed cleanup delete is appropriate.
  • J3 to the nullable scopes, which are handled via scopesOrNil.
  • S/R7 and P1–P6 do not apply: no sync or Grant/Revoke code changed.

The rotating vendor diff aside, there are no security issues and no new blocking issues.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged baton-sdk#1218 branch. The vendor tree also carries upstream sync-engine changes this PR doesn't describe, and the PR body itself says not to merge before #1218 is released. The open go.mod:7 thread covers this; the 6 outdated go.mod threads describe the same issue and are counted once. (Confidence: high)

Suggestions

  • Prior — still present (widened) pkg/connector/users.go:311: the plaintext format change from the bare key to api_key_v2 JSON is on by default with no opt-in (BP1). It now also covers the application key (users.go:215), which is the default, preferred issuance kind, so every vend changes format, not just the opt-in org key. Consumers that ignore PlaintextData.Schema (paper-vault until IGA-5311) get JSON instead of the key. The open thread covers the org-key part; the 4 outdated BP1 threads are counted with it. (Confidence: medium)
  • New docs/connector.mdx:36: the docs still say "A vended service account application key is still delivered as the bare key", which is now false. They also omit header_name/scopes (BP3/D-staleness). The PR title ("for org API keys") likewise understates the scope. (Confidence: high)
  • New pkg/connector/credential_smoke_test.go:97,111: the opt-in live app-key smoke test still passes the raw plaintext bytes (now JSON) to canAuthenticate as the app key. The usability check will time out, and the revocation check passes vacuously. Line 54 also uses the fixture testAPIBaseURL. (Confidence: high)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the org-key live smoke test still uses testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)
  • New pkg/connector/users.go:329-338: discardServiceAccountApplicationKey was inserted between discardOrganizationAPIKey's doc comment and its func. The two comments merge onto the new function, and the org helper is left undocumented. (Confidence: high)

Resolved prior findings

  • The two older base_url threads on users.go stay fixed: users.go:314 (org) and users.go:219 (app key) use the override-aware u.apiBaseURL.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor`, so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around lines 215 and 311: both the application key (the default issuance kind) and the org API key now return api_key_v2 JSON instead of the bare key, with no opt-in. Either gate the new format behind config, or explicitly confirm that every downstream consumer reads PlaintextData.Schema before rollout (IGA-5311).
- Around lines 329-338: move `discardServiceAccountApplicationKey` and its doc comment above the `// discardOrganizationAPIKey revokes ...` comment block, so each function keeps its own doc comment.

In `docs/connector.mdx`:
- Around line 36: replace "A vended service account application key is still delivered as the bare key" with text saying it is also delivered as api_key_v2 JSON. List the fields for both kinds (key_value, key_id, provider, base_url, header_name, plus scopes for application keys). Also update the PR title to cover both key kinds.

In `pkg/connector/credential_smoke_test.go`:
- Around lines 97 and 111: replace `string(issued.PlaintextData[0].GetBytes())` with `appKeyPlaintextKeyValue(t, issued)`, so canAuthenticate receives the actual key rather than the JSON document.
- Around line 54: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()`.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint, and optionally assert that the payload's BaseURL equals it.

Comment thread docs/connector.mdx
</Warning>

‡Organization API key issuance and revocation both require **Allow organization API key deletion**, which is off by default and is separate from **Sync secrets**. An organization API key belongs to the whole organization rather than to the person it was issued to, and it cannot be scoped, so C1 will not mint one it has no permission to revoke. With the setting off, organization API keys still sync; they simply cannot be issued or deleted.
‡Organization API key issuance and revocation both require **Allow organization API key deletion**, which is off by default and is separate from **Sync secrets**. An organization API key belongs to the whole organization rather than to the person it was issued to, and it cannot be scoped, so C1 will not mint one it has no permission to revoke. An issued organization API key is delivered as a Multipass API key (`application/vnd.multipass.api_key_v2+json`): a JSON object carrying the key itself, the key's Datadog ID, the provider, and the Datadog API base URL. A vended service account application key is still delivered as the bare key. With the setting off, organization API keys still sync; they simply cannot be issued or deleted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: This line still says "A vended service account application key is still delivered as the bare key". As of users.go:215 the application key is also api_key_v2 JSON, and it also carries header_name and scopes. The app key is the default (preferred) issuance kind, so the BP1/BP2 format change now reaches every vend, not just the opt-in org key. Update the docs (BP3) and the PR title, which still says "for org API keys". (Confidence: high)

Comment thread pkg/connector/users.go
Comment on lines +329 to +338
// discardOrganizationAPIKey revokes an organization API key whose plaintext
// cannot be returned. Issuance is not retried automatically, so a mint whose
// result never reaches the caller would otherwise be an orphaned live
// credential nobody holds. A failed delete is logged rather than returned: the
// original error is what the caller needs to see, and the key id is what lets
// an operator clean up by hand.
// discardServiceAccountApplicationKey revokes a service account application key
// whose plaintext cannot be returned. Same reasoning as
// discardOrganizationAPIKey: issuance is not retried, so a mint that never
// reaches the caller would otherwise be an orphaned live credential.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: discardServiceAccountApplicationKey was inserted between discardOrganizationAPIKey's doc comment and its func. godoc now merges both comments onto the new function, and discardOrganizationAPIKey is left undocumented. Move the new function, with its comment, above the // discardOrganizationAPIKey ... block. (Confidence: high)

require.True(t, ok)

issuer := newCredentialUserBuilder(datadogConnector.wrapper, false, true)
issuer := newCredentialUserBuilder(datadogConnector.wrapper, false, true, testAPIBaseURL)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: The application key plaintext is now api_key_v2 JSON. This live smoke test still passes string(issued.PlaintextData[0].GetBytes()) to canAuthenticate as the app key, at lines 97 and 111. With DATADOG_CREDENTIAL_SMOKE=1 the usability check will time out, and the revocation check passes vacuously because the JSON is always rejected. Use appKeyPlaintextKeyValue(t, issued) there, and datadogConnector.apiBaseURL() instead of the fixture testAPIBaseURL here. (Confidence: high)

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit e3606efb9f59

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 5 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 76a5019
View review run

Review Summary

The new commits extend the Multipass change to service-account application keys:

  • issueServiceAccountApplicationKey now emits api_key_v2 JSON with header_name: DD-APPLICATION-KEY and the reported scopes.
  • The app-key descriptor declares an output field, and baton_capabilities.json is regenerated to match.
  • The org key gains header_name: DD-API-KEY.
  • App-key cleanup moves into a new discardServiceAccountApplicationKey helper.

I scanned the full PR diff for security and correctness, including the vendored baton-sdk pin through go.mod/vendor/modules.txt; I did not review the vendor tree's content line by line. I applied the repo-local criteria:

  • BP1–BP3 to the plaintext format change, now including the default app-key kind.
  • E1/L1 to the new cleanup helper: the Warn level for a failed cleanup delete is appropriate.
  • J3 to the nullable scopes, which are handled via scopesOrNil.
  • S/R7 and P1–P6 do not apply: no sync or Grant/Revoke code changed.

The rotating vendor diff aside, there are no security issues and no new blocking issues.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged baton-sdk#1218 branch. The vendor tree also carries upstream sync-engine changes this PR doesn't describe, and the PR body itself says not to merge before #1218 is released. The open go.mod:7 thread covers this; the 6 outdated go.mod threads describe the same issue and are counted once. (Confidence: high)

Suggestions

  • Prior — still present (widened) pkg/connector/users.go:311: the plaintext format change from the bare key to api_key_v2 JSON is on by default with no opt-in (BP1). It now also covers the application key (users.go:215), which is the default, preferred issuance kind, so every vend changes format, not just the opt-in org key. Consumers that ignore PlaintextData.Schema (paper-vault until IGA-5311) get JSON instead of the key. The open thread covers the org-key part; the 4 outdated BP1 threads are counted with it. (Confidence: medium)
  • New docs/connector.mdx:36: the docs still say "A vended service account application key is still delivered as the bare key", which is now false. They also omit header_name/scopes (BP3/D-staleness). The PR title ("for org API keys") likewise understates the scope. (Confidence: high)
  • New pkg/connector/credential_smoke_test.go:97,111: the opt-in live app-key smoke test still passes the raw plaintext bytes (now JSON) to canAuthenticate as the app key. The usability check will time out, and the revocation check passes vacuously. Line 54 also uses the fixture testAPIBaseURL. (Confidence: high)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the org-key live smoke test still uses testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. The open thread covers this. (Confidence: high)
  • New pkg/connector/users.go:329-338: discardServiceAccountApplicationKey was inserted between discardOrganizationAPIKey's doc comment and its func. The two comments merge onto the new function, and the org helper is left undocumented. (Confidence: high)

Resolved prior findings

  • The two older base_url threads on users.go stay fixed: users.go:314 (org) and users.go:219 (app key) use the override-aware u.apiBaseURL.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor`, so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around lines 215 and 311: both the application key (the default issuance kind) and the org API key now return api_key_v2 JSON instead of the bare key, with no opt-in. Either gate the new format behind config, or explicitly confirm that every downstream consumer reads PlaintextData.Schema before rollout (IGA-5311).
- Around lines 329-338: move `discardServiceAccountApplicationKey` and its doc comment above the `// discardOrganizationAPIKey revokes ...` comment block, so each function keeps its own doc comment.

In `docs/connector.mdx`:
- Around line 36: replace "A vended service account application key is still delivered as the bare key" with text saying it is also delivered as api_key_v2 JSON. List the fields for both kinds (key_value, key_id, provider, base_url, header_name, plus scopes for application keys). Also update the PR title to cover both key kinds.

In `pkg/connector/credential_smoke_test.go`:
- Around lines 97 and 111: replace `string(issued.PlaintextData[0].GetBytes())` with `appKeyPlaintextKeyValue(t, issued)`, so canAuthenticate receives the actual key rather than the JSON document.
- Around line 54: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()`.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint, and optionally assert that the payload's BaseURL equals it.

Reviewed commit: 2d42b48da93c

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

Moving the application-key helper above the organization-key one left the
organization-key comment glued to the application-key func. Each comment now
sits directly above the function it describes.

Also replace the scopesOrNil comment, which argued both that omitempty drops
nil and empty lists and that the two are distinct.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit e3606efb9f59

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 4 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 2d42b48
View review run

Review Summary

The new commit changes only comments and declaration order in pkg/connector/users.go:

  • discardOrganizationAPIKey moves back directly under its own doc comment, ahead of discardServiceAccountApplicationKey.
  • The scopesOrNil comment is shortened.

There is no behavior change. I scanned the full PR diff again for security and correctness: the non-vendor connector, client, pkg/multipass and docs files, plus go.mod/go.sum, with the 94 vendor files checked only for dependency provenance. I found no secrets in logs, and the client still guards every pointer it dereferences on the create responses.

I applied the repo-local criteria as follows:

  • E (breaking-change gate): applied to the default-on plaintext format change.
  • A (log levels): the cleanup Warn lines are one-shot and customer-actionable.
  • D (J3, nullable scopes): applied to the scopes handling.
  • S (sync data loss): no List/Entitlements/Grants paths changed.

resolution_blocked is true, so stale outdated threads stay open. Every still-present issue below already has an open, accurate thread, so I posted no new inline comments.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged baton-sdk#1218 branch. The vendor tree also carries upstream sync-engine changes this PR doesn't describe, and the PR body itself says not to merge before #1218 is released. The open go.mod:7 thread covers this. The 6 outdated go.mod threads describe the same issue and are counted once. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:308 (org key) and the application-key issue path: the plaintext changes from the bare key to api_key_v2 JSON by default, with no opt-in (BP1). Any consumer that ignores PlaintextData.Schema (paper-vault until IGA-5311) gets JSON instead of the key. The open thread covers this, and the 4 outdated BP1 threads are counted with it. (Confidence: medium)
  • Prior — still present docs/connector.mdx:36: the docs still say "A vended service account application key is still delivered as the bare key", which is now false. They also omit header_name and scopes (BP3/D-staleness). (Confidence: high)
  • Prior — still present pkg/connector/credential_smoke_test.go:97,111: the opt-in live app-key smoke test still passes string(issued.PlaintextData[0].GetBytes()), which is now the JSON document, to canAuthenticate as the app key. The test is also built with the fixture testAPIBaseURL at line 54. (Confidence: high)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the org-key live smoke test still uses testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. (Confidence: high)

Resolved prior findings

  • Fixed: the doc comments were merged onto the wrong helper (users.go:344 thread). users.go:323-331 now places discardOrganizationAPIKey directly under its own doc comment, and discardServiceAccountApplicationKey at users.go:342-352 has its own doc comment.
  • Fixed, still: the two older base_url threads. users.go:309 and the app-key path use the override-aware u.apiBaseURL.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor` so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around line 308 and the application-key issue path: the plaintext format changed from the bare key to api_key_v2 JSON with no opt-in. Either gate the new format behind a config flag, or confirm that every consumer (including paper-vault before IGA-5311) reads PlaintextData.Schema before merging.

In `docs/connector.mdx`:
- Around line 36: remove "A vended service account application key is still delivered as the bare key". State that both key kinds are delivered as api_key_v2 JSON, and list the header_name field (DD-API-KEY / DD-APPLICATION-KEY) and the app-key scopes field.

In `pkg/connector/credential_smoke_test.go`:
- Around lines 97 and 111: replace `string(issued.PlaintextData[0].GetBytes())` with the decoded `key_value` (e.g. `appKeyPlaintextKeyValue(t, issued)`) so canAuthenticate receives the actual key.
- Around line 54: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()`.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint. Optionally assert that the payload's BaseURL equals it.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Connector PR Review: IGA-5308: Emit Multipass api_key_v2 JSON for org API keys

Blocking Issues: 1 | Suggestions: 4 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 917935039b96.
Review mode: incremental since 2d42b48
View review run

Review Summary

The new commit changes only comments and declaration order in pkg/connector/users.go:

  • discardOrganizationAPIKey moves back directly under its own doc comment, ahead of discardServiceAccountApplicationKey.
  • The scopesOrNil comment is shortened.

There is no behavior change. I scanned the full PR diff again for security and correctness: the non-vendor connector, client, pkg/multipass and docs files, plus go.mod/go.sum, with the 94 vendor files checked only for dependency provenance. I found no secrets in logs, and the client still guards every pointer it dereferences on the create responses.

I applied the repo-local criteria as follows:

  • E (breaking-change gate): applied to the default-on plaintext format change.
  • A (log levels): the cleanup Warn lines are one-shot and customer-actionable.
  • D (J3, nullable scopes): applied to the scopes handling.
  • S (sync data loss): no List/Entitlements/Grants paths changed.

resolution_blocked is true, so stale outdated threads stay open. Every still-present issue below already has an open, accurate thread, so I posted no new inline comments.

Security Issues

None found.

Correctness Issues

  • Prior — still present go.mod:7: baton-sdk is still pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 (vendor/modules.txt:281), from the unmerged baton-sdk#1218 branch. The vendor tree also carries upstream sync-engine changes this PR doesn't describe, and the PR body itself says not to merge before #1218 is released. The open go.mod:7 thread covers this. The 6 outdated go.mod threads describe the same issue and are counted once. (Confidence: high)

Suggestions

  • Prior — still present pkg/connector/users.go:308 (org key) and the application-key issue path: the plaintext changes from the bare key to api_key_v2 JSON by default, with no opt-in (BP1). Any consumer that ignores PlaintextData.Schema (paper-vault until IGA-5311) gets JSON instead of the key. The open thread covers this, and the 4 outdated BP1 threads are counted with it. (Confidence: medium)
  • Prior — still present docs/connector.mdx:36: the docs still say "A vended service account application key is still delivered as the bare key", which is now false. They also omit header_name and scopes (BP3/D-staleness). (Confidence: high)
  • Prior — still present pkg/connector/credential_smoke_test.go:97,111: the opt-in live app-key smoke test still passes string(issued.PlaintextData[0].GetBytes()), which is now the JSON document, to canAuthenticate as the app key. The test is also built with the fixture testAPIBaseURL at line 54. (Confidence: high)
  • Prior — still present pkg/connector/credential_org_key_smoke_test.go:61,71: the org-key live smoke test still uses testAPIBaseURL instead of datadogConnector.apiBaseURL(), so the real key it mints advertises a fake base_url. (Confidence: high)

Resolved prior findings

  • Fixed: the doc comments were merged onto the wrong helper (users.go:344 thread). users.go:323-331 now places discardOrganizationAPIKey directly under its own doc comment, and discardServiceAccountApplicationKey at users.go:342-352 has its own doc comment.
  • Fixed, still: the two older base_url threads. users.go:309 and the app-key path use the override-aware u.apiBaseURL.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `go.mod`:
- Around line 7: baton-sdk is pinned to the unreleased pseudo-version v0.44.1-0.20261103220501-dc065ae56b48 from the unmerged baton-sdk#1218 branch. Once #1218 is merged and released, repin to that release tag and run `go mod tidy && go mod vendor` so the vendor tree matches a released SDK.

## Suggestions

In `pkg/connector/users.go`:
- Around line 308 and the application-key issue path: the plaintext format changed from the bare key to api_key_v2 JSON with no opt-in. Either gate the new format behind a config flag, or confirm that every consumer (including paper-vault before IGA-5311) reads PlaintextData.Schema before merging.

In `docs/connector.mdx`:
- Around line 36: remove "A vended service account application key is still delivered as the bare key". State that both key kinds are delivered as api_key_v2 JSON, and list the header_name field (DD-API-KEY / DD-APPLICATION-KEY) and the app-key scopes field.

In `pkg/connector/credential_smoke_test.go`:
- Around lines 97 and 111: replace `string(issued.PlaintextData[0].GetBytes())` with the decoded `key_value` (e.g. `appKeyPlaintextKeyValue(t, issued)`) so canAuthenticate receives the actual key.
- Around line 54: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()`.

In `pkg/connector/credential_org_key_smoke_test.go`:
- Around lines 61 and 71: replace `testAPIBaseURL` with `datadogConnector.apiBaseURL()` so the live smoke test advertises the real endpoint. Optionally assert that the payload's BaseURL equals it.

Reviewed commit: e3606efb9f59

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found — see the full review report

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