Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(configuration): missing request_uris option #7033

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

james-d-elliott
Copy link
Member

@james-d-elliott james-d-elliott commented Mar 27, 2024

This fixes a missing option for OpenID Connect 1.0 clients 'request_uris'. This feature was effectively implemented but no way to configure it existed.

Summary by CodeRabbit

  • New Features
    • Introduced a new configuration field request_uris for OpenID Connect clients, enabling the use of URIs for passing Authorize Request parameters.
  • Enhancements
    • Updated Swagger UI version to "5.12.3" for improved user interface and stability.
  • Documentation
    • Documented the addition of request_uris under the OpenID Connect client configuration section.
  • Bug Fixes
    • Enhanced validation for OpenID Connect client request URIs to prevent configuration errors.

This fixes a missing option for OpenID Connect 1.0 clients 'redirect_uris'. This feature was effectively implemented but no way to configure it existed.

Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
@authelia
Copy link

authelia bot commented Mar 27, 2024

Artifacts

These changes are published for testing on Buildkite, DockerHub and GitHub Container Registry.

Docker Container

  • docker pull authelia/authelia:fix-missing-request-uris
  • docker pull ghcr.io/authelia/authelia:fix-missing-request-uris

Copy link
Contributor

coderabbitai bot commented Mar 27, 2024

Walkthrough

This update introduces enhancements and a new feature to the OpenID Connect client configuration within the project. The Swagger UI version has been upgraded to improve the API documentation experience. A significant addition is the request_uris configuration field under identity_providers for OpenID Connect clients, allowing the specification of URIs for passing Authorize Request parameters via a remote JSON Web Token. The implementation involves updates to configuration schemas, validation processes, and the internal OIDC client setup.

Changes

File(s) Change Summary
cmd/authelia-scripts/cmd/gen.go Updated Swagger UI version from "5.12.0" to "5.12.3".
docs/content/configuration/.../openid-connect/clients.md Added request_uris configuration field for specifying URIs in OpenID Connect client configuration.
internal/configuration/schema/identity_providers.go, internal/configuration/schema/keys.go, internal/configuration/schema/types.go, internal/configuration/schema/types_test.go, internal/oidc/client.go Introduced and integrated RequestURIs field in OIDC client configuration, including schema updates and renaming RedirectURIs to URIs.
internal/configuration/validator/const.go, internal/configuration/validator/identity_providers.go, internal/configuration/validator/identity_providers_test.go Enhanced validation for OpenID Connect client request URIs, including new error formats and test cases.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

netlify bot commented Mar 27, 2024

Deploy Preview for authelia-staging ready!

Name Link
🔨 Latest commit 4fcca03
🔍 Latest deploy log https://app.netlify.com/sites/authelia-staging/deploys/6603fedc192bd300082a5ad7
😎 Deploy Preview https://deploy-preview-7033--authelia-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e944418 and 4fcca03.
Files ignored due to path filters (4)
  • config.template.yml is excluded by: !**/*.yml
  • docs/static/schemas/latest/json-schema/configuration.json is excluded by: !**/*.json
  • docs/static/schemas/v4.38/json-schema/configuration.json is excluded by: !**/*.json
  • internal/configuration/config.template.yml is excluded by: !**/*.yml
Files selected for processing (10)
  • cmd/authelia-scripts/cmd/gen.go (1 hunks)
  • docs/content/configuration/identity-providers/openid-connect/clients.md (2 hunks)
  • internal/configuration/schema/identity_providers.go (1 hunks)
  • internal/configuration/schema/keys.go (1 hunks)
  • internal/configuration/schema/types.go (1 hunks)
  • internal/configuration/schema/types_test.go (1 hunks)
  • internal/configuration/validator/const.go (2 hunks)
  • internal/configuration/validator/identity_providers.go (2 hunks)
  • internal/configuration/validator/identity_providers_test.go (7 hunks)
  • internal/oidc/client.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • cmd/authelia-scripts/cmd/gen.go
Additional comments: 13
internal/configuration/schema/keys.go (1)
  • 43-43: The addition of "identity_providers.oidc.clients[].request_uris" to the schema keys list correctly implements the new request_uris configuration option for OpenID Connect clients. This change aligns with the PR objectives and is implemented correctly.
internal/oidc/client.go (1)
  • 28-28: The addition of the RequestURIs field to the NewClient function's configuration correctly implements the new request_uris configuration option for OpenID Connect clients. This change aligns with the PR objectives and is implemented correctly.
internal/configuration/schema/types.go (1)
  • 497-499: Renaming IdentityProvidersOpenIDConnectClientRedirectURIs to IdentityProvidersOpenIDConnectClientURIs correctly reflects the addition of the request_uris configuration option and generalizes the type for both redirect URIs and request URIs. This change aligns with the PR objectives and is implemented correctly.
internal/configuration/schema/identity_providers.go (1)
  • 118-119: The addition of the RequestURIs field to the IdentityProvidersOpenIDConnectClient struct is well-implemented, with appropriate JSON and schema tags. This change aligns with the PR's objectives and enhances the configurability of OpenID Connect clients.

However, it's essential to ensure that this new configuration option integrates seamlessly with the existing system and does not introduce any unintended side effects. Testing and validation should cover scenarios where the RequestURIs are specified, as well as backward compatibility with configurations that do not use this new field.

internal/configuration/schema/types_test.go (1)
  • 368-368: The renaming of IdentityProvidersOpenIDConnectClientRedirectURIs to IdentityProvidersOpenIDConnectClientURIs is correctly reflected in the test cases. This change aligns with the PR's objective to introduce and utilize the request_uris configuration option for OpenID Connect clients.
docs/content/configuration/identity-providers/openid-connect/clients.md (1)
  • 206-213: The request_uris configuration option is correctly documented, including the requirement for URIs to use the https scheme. This aligns with the PR objectives to enhance security and flexibility in OpenID Connect client configurations.
internal/configuration/validator/const.go (2)
  • 230-236: The addition of error formats for OIDC client request URIs is consistent with the PR objectives to enhance OpenID Connect client configurations by introducing the request_uris option. These error messages are well-defined and follow the existing pattern for error messages in this file.
  • 524-524: The addition of the attrOIDCRequestURIs constant aligns with the introduction of the request_uris configuration option for OpenID Connect clients. This constant is correctly named and follows the naming convention of other OIDC-related constants in this file.
internal/configuration/validator/identity_providers.go (1)
  • 933-957: The addition of the validateOIDCClientRequestURIs function enhances the validation of request URIs for OpenID Connect clients by ensuring they are absolute URLs, use the HTTPS scheme, and are unique. This is a crucial security measure for preventing potential vulnerabilities related to insecure request URIs. Good job on implementing these checks.
internal/configuration/validator/identity_providers_test.go (4)
  • 325-372: The test cases for validating OIDC client JWKS are comprehensive and well-structured, covering a wide range of scenarios including URL validation, key properties, and error handling for invalid configurations.
  • 325-372: The test cases for validating OIDC issuer configuration are thorough and cover essential aspects such as key and certificate validation, algorithm support, and error handling for invalid configurations.
  • 325-372: The test cases for validating OIDC lifespans configuration effectively cover scenarios related to default values, custom definitions, and error handling for invalid configurations.
  • 325-372: The test cases for validating OIDC authorization policies are comprehensive, covering validation of policy names, default policies, custom rules, and error handling for invalid configurations.

Comment on lines 36 to 43
public: false
redirect_uris:
- 'https://oidc.example.com:8080/oauth2/callback'
request_uris:
- 'https://oidc.example.com:8080/oidc/request-object.jwk'
audience:
- 'https://app.example.com'
scopes:
Copy link
Contributor

Choose a reason for hiding this comment

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

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [17-17]

Consider using a hyphen in "provider specific" to form the compound adjective "provider-specific".

- For the provider specific configuration and information not related to clients see the [OpenID Connect 1.0 Provider](provider.md)
+ For the provider-specific configuration and information not related to clients see the [OpenID Connect 1.0 Provider](provider.md)

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [18-18]

A comma may improve readability after "clients".

- For the provider specific configuration and information not related to clients see the [OpenID Connect 1.0 Provider](provider.md)
+ For the provider specific configuration and information not related to clients, see the [OpenID Connect 1.0 Provider](provider.md)

@@ -365,7 +365,7 @@ func TestJSONSchema(t *testing.T) {
&AccessControlRuleMethods{},
&AccessControlRuleRegex{},
&AccessControlRuleSubjects{},
&IdentityProvidersOpenIDConnectClientRedirectURIs{},
&IdentityProvidersOpenIDConnectClientURIs{},
Copy link
Contributor

Choose a reason for hiding this comment

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

Considering the introduction of the request_uris configuration option, it would be beneficial to include test cases that specifically validate its behavior and correct configuration. This could involve testing the validation logic for the URIs specified, ensuring they adhere to the https scheme, and verifying their correct usage within the OIDC client initialization process.

Would you like me to suggest a template for such test cases?

@james-d-elliott james-d-elliott merged commit ab4d14c into master Mar 27, 2024
47 checks passed
@james-d-elliott james-d-elliott deleted the fix-missing-request-uris branch March 27, 2024 11:25
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.

None yet

1 participant