Skip to content

feat: add M2M client syncer (NHI APP_REGISTRATION) - #54

Open
c1-squire-dev[bot] wants to merge 3 commits into
mainfrom
nhi/add-m2m-client-syncer
Open

feat: add M2M client syncer (NHI APP_REGISTRATION)#54
c1-squire-dev[bot] wants to merge 3 commits into
mainfrom
nhi/add-m2m-client-syncer

Conversation

@c1-squire-dev

@c1-squire-dev c1-squire-dev Bot commented May 31, 2026

Copy link
Copy Markdown

Summary

Adds a new client resource-type syncer for Auth0 machine-to-machine (M2M) clients/applications, emitting the new non-human-identity (NHI) spine value NHI_TYPE_APP_REGISTRATION.

This is NHI Phase-1, Class-B (new-syncer) work for Auth0 — see RFC v6 §5.8.7 and §6 row 13. The connector previously registered no client/application resource type at all (resource_types.go), so M2M clients were invisible. M2M clients hold their own credentials & scopes → K3 / APP_REGISTRATION.

What changed

  • New resource type clientResourceType (client, TRAIT_APP, skips entitlements/grants) — pkg/connector/resource_types.go.
  • New builder clientBuilder with a read-only paginated Listpkg/connector/clients.go. Registered in ResourceSyncers (pkg/connector/connector.go).
  • New client call GetClients over GET /api/v2/clientspkg/client/auth0.go (+ Application/ClientsResponse models, apiPathGetClients).
  • Emits WithNHIType(NHI_TYPE_APP_REGISTRATION, "auth0.m2m_client") (axis-2 dotted-lowercase detail per RFC §2.8).
  • Bumps baton-sdk v0.10.0 → v0.11.0 (provides the NHI trait + WithNHIType builder); re-vendored.
  • Testspkg/connector/clients_test.go covers the M2M discriminator and NHI emission.

M2M discriminator (enumerability scope-guard)

GET /api/v2/clients enumerates all tenant clients (Auth0 docs) and supports a server-side app_type filter. We request app_type=non_interactive (the canonical Auth0 marker for M2M) and defensively re-check each result in code, accepting a client_credentials grant type as a fallback signal. User-facing app types (spa, native, regular_web) are excluded. Scope-guard passes — enumeration is feasible and filtered.

Verification

  • go build ./...
  • go test ./... ✅ (new + existing pass)
  • golangci-lint run ./... ✅ 0 issues

Notes / divergence from RFC

  • RFC §5.8.7 referenced pkg/connector/auth0/auth0.go; the real connector path is flat (pkg/connector/connector.go). Wired there.
  • RFC used the stale builder name WithNHISubtype; the real v0.11.0 API is WithNHIType(NonHumanIdentityTrait_NhiType, detail) — used the real symbol.

🤖 Generated with Claude Code

@c1-squire-dev
c1-squire-dev Bot requested a review from a team May 31, 2026 16:08
@github-actions

github-actions Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Connector PR Review: feat: add M2M client syncer (NHI APP_REGISTRATION)

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Review mode: incremental since 6401ed8
View review run

Review Summary

The new commit adds read:clients to both the READ and READ/WRITE permission lists in docs/connector.mdx, directly addressing the previous review finding about missing scope documentation. No new issues found in the incremental change, and a scan of the full PR diff surfaces no security or correctness concerns.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

@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.

No blocking issues found.

Adds a new `client` resource-type syncer for Auth0 machine-to-machine (M2M)
clients/applications (NHI Phase-1 Class-B, RFC §5.8.7 / §6 row 13). The
connector previously synced no `client`/application resource type.

- New `clientBuilder` + `clientResourceType` (TRAIT_APP), read-only paginated
  List over `GET /api/v2/clients`, filtered server-side to
  `app_type=non_interactive` with a `client_credentials` grant-type fallback.
- Emits `WithNHIType(NHI_TYPE_APP_REGISTRATION, "auth0.m2m_client")` (axis-2
  dotted-lowercase detail per RFC §2.8).
- Bumps baton-sdk v0.10.0 -> v0.11.0 (provides the NHI trait + builder) and
  re-vendors.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@c1-squire-dev
c1-squire-dev Bot force-pushed the nhi/add-m2m-client-syncer branch from 5ede052 to 47dedfb Compare May 31, 2026 16:57

@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.

No blocking issues found.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Comment thread docs/connector.mdx
| Accounts | <Icon icon="square-check" iconType="solid" color="#c937ae"/> | |
| Roles | <Icon icon="square-check" iconType="solid" color="#c937ae"/>\* | <Icon icon="square-check" iconType="solid" color="#c937ae"/> |
| Organizations | <Icon icon="square-check" iconType="solid" color="#c937ae"/> | <Icon icon="square-check" iconType="solid" color="#c937ae"/> |
| M2M Clients | <Icon icon="square-check" iconType="solid" color="#c937ae"/> | |

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 capabilities table now lists M2M Clients (addressing the previous review feedback), but the read:clients scope is still missing from both the READ and READ/WRITE permission lists later in this file (around lines 48-55 and 57-66). The new GET /api/v2/clients endpoint requires this scope — existing installs upgrading will need to add it. Please add read:clients to both permission lists.

@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.

No blocking issues found.

The M2M client syncer calls GET /api/v2/clients, which requires the
read:clients scope. Adds it to both the READ and READ/WRITE permission
lists. Addresses review finding D3.

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

c1-squire-dev Bot commented Jun 10, 2026

Copy link
Copy Markdown
Author

Addressed review finding D3: added read:clients to both the READ and READ/WRITE permission lists in the credential setup instructions — the M2M client syncer calls GET /api/v2/clients, which requires that scope.

@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.

No blocking issues found.

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