Skip to content

[OIDC] Enhance OIDC Integration: Secure client secret handling and fix access token storage #4159

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

SoniaComp
Copy link
Contributor

What changes were proposed in this pull request?

  • Improved security by allowing oidc_rp_client_secret to be provided via script input, reducing the risk associated with hardcoded or environment-variable-based secrets.
  • Bug fix for proper storage of access tokens: Addressed an issue where access tokens were not being stored correctly, ensuring tokens are saved as expected.

How was this patch tested?

This patch was tested by building the Hue Docker image internally and deploying it via Helm chart. We verified the integration with Keycloak OIDC during testing.

Please review Hue Contributing Guide before opening a pull request.

Copy link

github-actions bot commented Jun 4, 2025

⚠️ No test files modified. Please ensure that changes are properly tested. ⚠️

Copy link

github-actions bot commented Jun 4, 2025

UI Coverage Report

Lines Statements Branches Functions
Coverage: 32%
39.15% (30527/77959) 31.01% (14247/45936) 23.89% (2130/8915)

Copy link

github-actions bot commented Jun 4, 2025

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances OIDC integration by introducing support for dynamically acquiring the OIDC RP client secret via a script and fixes access token storage issues.

  • Introduces a new configuration option (OIDC_RP_CLIENT_SECRET_SCRIPT) for secret retrieval.
  • Adjusts the authentication and logout methods to use the new secret source as a fallback.
  • Updates configuration templates to document the new option.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
desktop/core/src/desktop/settings.py Added retrieval for a new client secret script configuration.
desktop/core/src/desktop/conf.py Updated default client secret value and added a new secret script config.
desktop/core/src/desktop/auth/backend.py Modified authentication flow to use the new secret and added token-saving behavior; possible indentation issue.
desktop/conf/pseudo-distributed.ini.tmpl Updated config comments to include the new secret script option (naming inconsistency noted).
desktop/conf.dist/hue.ini Updated config comments to include the new secret script option (naming inconsistency noted).
Comments suppressed due to low confidence (3)

desktop/core/src/desktop/auth/backend.py:875

  • The function 'save_refresh_tokens' appears to be indented within 'save_access_tokens', causing it to be defined as a nested function instead of a class method. Consider moving it to the same indentation level as 'save_access_tokens'.
def save_refresh_tokens(self, refresh_token):

desktop/conf/pseudo-distributed.ini.tmpl:834

  • The configuration key in the template ('oidc_rp_client_script') does not match the key used in the code ('oidc_rp_client_secret_script'). Update the template for consistency.
## oidc_rp_client_script=

desktop/conf.dist/hue.ini:832

  • The configuration key in the template ('oidc_rp_client_script') does not match the key used in the code ('oidc_rp_client_secret_script'). Update the template for consistency.
## oidc_rp_client_script=

Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

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

Thanks @SoniaComp for contributing a fix!
I've left one small review comment.

Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines 1613 to 1614
default="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
default=""
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

@SoniaComp Looks like there are some unit test failures, can you please check? Also is this change required?

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.

2 participants