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(oidc): missing introspection claims #7049

Merged
merged 2 commits into from
Mar 31, 2024

Conversation

james-d-elliott
Copy link
Member

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

This fixes a regression of the claims returned by the introspection endpoint.

Summary by CodeRabbit

  • Refactor
    • Simplified OAuth introspection handling for better control flow.
  • New Features
    • Expanded configuration options to include introspection settings.
    • Enhanced support for introspection in client registrations.

@authelia
Copy link

authelia bot commented Mar 30, 2024

Artifacts

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

Docker Container

  • docker pull authelia/authelia:fix-introspection-claims
  • docker pull ghcr.io/authelia/authelia:fix-introspection-claims

Copy link
Contributor

coderabbitai bot commented Mar 30, 2024

Walkthrough

The recent update focuses on enhancing the OAuth introspection functionality within the system. It introduces a cleaner separation of concerns by refactoring the OAuthIntrospectionPOST function to improve logic flow. Additionally, the configuration and types have been expanded to support new introspection capabilities, including issuer configuration and JWT response signing. This update streamlines introspection handling and extends support for client-specific introspection responses.

Changes

Files Change Summary
.../handler_oauth_introspection.go Refactored OAuthIntrospectionPOST to use WriteIntrospectionResponse, simplifying logic and control flow.
.../oidc/config.go Added Introspection field to IssuersConfig and introduced methods for introspection issuer and JWT signing.
.../oidc/types.go Included support for IntrospectionJWTResponseClient in RegisteredClient type.

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 testing code 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 testing code 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 testing code.
    • @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

codecov bot commented Mar 30, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 73.63%. Comparing base (a224420) to head (0f14c6b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7049      +/-   ##
==========================================
+ Coverage   73.28%   73.63%   +0.34%     
==========================================
  Files         345      345              
  Lines       29996    29919      -77     
  Branches      839      839              
==========================================
+ Hits        21982    22030      +48     
+ Misses       7141     7018     -123     
+ Partials      873      871       -2     
Flag Coverage Δ
backend 74.52% <87.50%> (+0.39%) ⬆️
frontend 65.77% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
internal/oidc/config.go 100.00% <100.00%> (+12.24%) ⬆️
internal/oidc/types.go 0.00% <ø> (ø)
internal/handlers/handler_oauth_introspection.go 0.00% <0.00%> (ø)

... and 6 files with indirect coverage changes

This fixes a regression of the claims returned by the introspection endpoint.

Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
@james-d-elliott james-d-elliott marked this pull request as ready for review March 31, 2024 02:51
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.

Actionable comments posted: 3

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a224420 and bb922b6.
Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod, !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
Files selected for processing (3)
  • internal/handlers/handler_oauth_introspection.go (2 hunks)
  • internal/oidc/config.go (2 hunks)
  • internal/oidc/types.go (1 hunks)
Additional Context Used
GitHub Check Runs (1)
codecov/patch failure (3)

internal/handlers/handler_oauth_introspection.go: [warning] 43-43: internal/handlers/handler_oauth_introspection.go#L43
Added line #L43 was not covered by tests


internal/oidc/config.go: [warning] 481-482: internal/oidc/config.go#L481-L482
Added lines #L481 - L482 were not covered by tests


internal/oidc/config.go: [warning] 486-487: internal/oidc/config.go#L486-L487
Added lines #L486 - L487 were not covered by tests

Additional comments not posted (2)
internal/oidc/config.go (1)

170-172: The addition of the Introspection field to the IssuersConfig struct is a clear and straightforward enhancement to support introspection-related functionality.

internal/oidc/types.go (1)

998-998: The addition of IntrospectionJWTResponseClient interface implementation for RegisteredClient is correctly done and follows Go's idiomatic way to ensure interface compliance at compile time. This is a good practice for type safety.

internal/oidc/config.go Show resolved Hide resolved
internal/oidc/config.go Show resolved Hide resolved
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.

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a224420 and 9076693.
Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod, !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
Files selected for processing (4)
  • internal/handlers/handler_oauth_introspection.go (2 hunks)
  • internal/oidc/config.go (3 hunks)
  • internal/oidc/config_test.go (1 hunks)
  • internal/oidc/types.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • internal/handlers/handler_oauth_introspection.go
  • internal/oidc/config.go
  • internal/oidc/types.go
Additional Context Used
Additional comments not posted (2)
internal/oidc/config_test.go (2)

260-330: The test function TestConfig_GetIssuerFuncs is well-structured and covers various scenarios for issuer configurations. It's a good practice to include such comprehensive tests, especially when dealing with critical functionality like OIDC introspection. However, consider adding a brief comment above each test case within the testCases slice to explain the specific scenario it's testing. This will improve readability and maintainability, making it easier for future contributors to understand the purpose of each test case quickly.


332-378: The TestMisc function tests various miscellaneous functionalities within the oidc.Config struct. While it's good to have such a comprehensive test, the function name TestMisc is quite generic. Consider renaming it to something more descriptive of the functionalities it's testing, such as TestConfig_IntrospectionAndResponseModeBehaviors. This would improve clarity and make it easier to understand the scope of the tests at a glance.

Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
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.

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a224420 and 0f14c6b.
Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod, !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
Files selected for processing (4)
  • internal/handlers/handler_oauth_introspection.go (2 hunks)
  • internal/oidc/config.go (3 hunks)
  • internal/oidc/config_test.go (1 hunks)
  • internal/oidc/types.go (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • internal/handlers/handler_oauth_introspection.go
  • internal/oidc/config.go
  • internal/oidc/config_test.go
  • internal/oidc/types.go
Additional Context Used

@james-d-elliott james-d-elliott merged commit 2ffd5c5 into master Mar 31, 2024
49 checks passed
@james-d-elliott james-d-elliott deleted the fix-introspection-claims branch March 31, 2024 03:42
Crowley723 pushed a commit to Crowley723/authelia that referenced this pull request Apr 1, 2024
This fixes a regression of the claims returned by the introspection endpoint.

Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant