Skip to content

feat(dynamic-registration): add full oid compliance - #11

Open
tugascript wants to merge 5 commits into
masterfrom
tugascript/oid-dcr/fix-complete
Open

tugascript wants to merge 5 commits into
masterfrom
tugascript/oid-dcr/fix-complete

Conversation

@tugascript

@tugascript tugascript commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes)
  • Other... Please describe:

What is the current behavior?

Has a bunch of custom application types

What is the new behavior?

Removes the application type from

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

It is an explicitly WIP, security-sensitive change spanning schema, OAuth/OIDC registration logic, and an unmitigated SSRF vector in the new sector_identifier_uri fetch, so it needs human review.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)
What changed in this PR

This WIP PR moves the IdP toward fuller OpenID Connect Dynamic Client Registration compliance. It removes the custom transport concept and collapses the previous seven application types (web/native/spa/backend/device/service/mcp) down to web and native, folding SPA/service/backend behavior into web (public vs. confidential, distinguished by token_endpoint_auth_method and grant_types). It also adds OIDC sector_identifier_uri handling, the implicit grant type, and error_description on OAuth error responses. The corresponding tables (app_related_apps, app_service_configs) and their service/test code are removed.

Changes:

  • Remove transport and the device/service/backend/spa/mcp app types; route public/service clients through the web type via grant_types/token_endpoint_auth_method.
  • Add OIDC sector_identifier_uri fetching/validation and the implicit grant type.
  • Add error_description to OAuth error responses and update registration validation, DTOs, schema, and tests accordingly.
File Description
project.md Updates roadmap to reflect the simplified app-type model.
idp/​internal/​controllers/​oauth_dynamic_registration_account.go Adds error_description passthrough; introduces the isAuthenticaed misspelled variable.
idp/​internal/​services/​registration_metadata.go New sector_identifier_uri fetch/validation and reworked redirect/URI validation.
idp/​internal/​controllers/​bodies/​oauth_dynamic_registration.go Adds implicit to accepted grant types.
idp/​internal/​services/​app_dynamic_registration.go New grant-type/auth-method validation, AuthMethodNone handling, tx threading.
idp/​internal/​controllers/​helpers.go Makes oauthErrorResponse variadic for descriptions; generic server-error logging.
idp/​internal/​exceptions/​controllers.go Adds ErrorDescription field and NewOAuthErrorWithDescription.
idp/​tests/​apps_test.go Drops spa/backend/device/service/mcp cases; adds public-web and web-service cases.
idp/​tests/​dynamic_registration_test.go Threads DekKid into credential key creation.
idp/​tests/​oauth_test.go, idp/​tests/​account_credentials_test.go Remove transport fields from fixtures.
idp/​tests/​common_test.go Raises test request timeout from 2s to 60s.
Files not reviewed (4)
  • idp/internal/providers/database/account_credentials.sql.go: Generated file
  • idp/internal/providers/database/apps.sql.go: Generated file
  • idp/internal/providers/database/models.go: Generated file
  • idp/internal/providers/database/registered_apps.sql.go: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread idp/internal/services/registration_metadata.go
Comment thread idp/internal/controllers/oauth_dynamic_registration_account.go
Co-authored-by: tugascript <64930104+tugascript@users.noreply.github.com>
@tugascript tugascript changed the title WIP feat(dynamic-registration): add full oid compliance feat(dynamic-registration): add full oid compliance Oct 7, 2026
@tugascript
tugascript marked this pull request as ready for review October 7, 2026 15:18
@tugascript

Copy link
Copy Markdown
Owner Author

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T09:44:02.333114Z 8255784 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fdd4f61aed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread idp/internal/services/registration_metadata.go
Comment thread idp/internal/controllers/bodies/oauth_dynamic_registration.go Outdated
@tugascript
tugascript requested a balanced review from Copilot October 8, 2026 09:35
@tugascript

Copy link
Copy Markdown
Owner Author

@codex

Copilot AI 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.

🔵 Needs a closer look

It rewrites the initial database schema/migration and security-sensitive dynamic-registration logic while removing several app types, a breadth of high-risk change that warrants final human review.

0 open findings

2 resolved since last review
Files not reviewed (4)
  • idp/internal/providers/database/account_credentials.sql.go: Generated file
  • idp/internal/providers/database/apps.sql.go: Generated file
  • idp/internal/providers/database/models.go: Generated file
  • idp/internal/providers/database/registered_apps.sql.go: Generated file

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8255784c55

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return exceptions.NewError(exceptions.OAuthErrorInvalidClientMetadata, "sector_identifier_uri host must resolve to a public address")
}

sectorRedirects, err := fetchSectorIdentifierURIs(ctx, sectorIdentifierURI)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move sector URI fetching outside the database transaction

When app registration does not require an initial access token, an unauthenticated registrant can provide a public sector_identifier_uri whose HTTPS response stalls. CreateAppCredentialsRegistration enters registrationTransaction before metadata preparation reaches this fetch, so every request holds a database connection and transaction for up to the client's 10-second timeout; concurrent requests can exhaust the pool and block unrelated database work. Fetch and validate remote metadata before opening the transaction, or otherwise avoid holding a connection during this network request.

Useful? React with 👍 / 👎.

TokenEndpointAuthMethod string `json:"token_endpoint_auth_method,omitempty" validate:"omitempty,oneof=none client_secret_basic client_secret_post client_secret_jwt private_key_jwt"`
ResponseTypes []string `json:"response_types,omitempty" validate:"omitempty,dive,oneof=code 'code id_token'"`
GrantTypes []string `json:"grant_types,omitempty" validate:"omitempty,min=1,dive,oneof=authorization_code refresh_token client_credentials urn:ietf:params:oauth:grant-type:jwt-bearer"`
ResponseTypes []string `json:"response_types,omitempty" validate:"omitempty,dive,oneof=code id_token 'code id_token'"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist the newly accepted id_token response type

An implicit-only registration with grant_types: ["implicit"] and response_types: ["id_token"] now passes request binding and metadata normalization, but still fails when mapped for persistence. Fresh evidence in the current tree is that mapResponseTypesWithDefault and the database response_type enum still support only code and code id_token, so the mapper returns invalid response type: id_token; add the standalone response type throughout the mapper/model/schema path.

Useful? React with 👍 / 👎.

Comment on lines +357 to +359
if firstHost == "" {
firstHost = parsed.Host
} else if !strings.EqualFold(firstHost, parsed.Host) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compare hostnames without ports for pairwise clients

For a pairwise client without a sector URI, redirects such as https://client.example/callback and https://client.example:8443/callback have the same host component but are rejected because url.URL.Host includes the port. This unnecessarily forces otherwise valid clients with multiple ports to publish a sector document; compare parsed.Hostname() values instead.

Useful? React with 👍 / 👎.

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.

3 participants