Skip to content

Enforce oauth2.plugins as an allow-list for OAuth2 login providers - #13866

Open
Damans227 wants to merge 1 commit into
apache:mainfrom
Damans227:fix-oauth2-plugins-allowlist
Open

Enforce oauth2.plugins as an allow-list for OAuth2 login providers#13866
Damans227 wants to merge 1 commit into
apache:mainfrom
Damans227:fix-oauth2-plugins-allowlist

Conversation

@Damans227

Copy link
Copy Markdown
Collaborator

Fixes #13862.

oauth2.plugins (default google,github, described as "List of OAuth plugins") was declared as a ConfigKey but never read anywhere. Actual provider availability was determined entirely by which Spring beans exist plus oauth2.plugins.exclude, so changing oauth2.plugins was a complete no-op, an admin could set it to github,keycloak and google would remain fully functional.

This wires it up as an allow-list: a provider must be named in oauth2.plugins to be usable.

  • OAuth2AuthManagerImpl.getUserOAuth2AuthenticationProvider() now rejects any provider not in the configured list (covers both the oauthlogin and verifyOAuthCodeAndGetUser paths, since both resolve the provider through this method).
  • OAuth2AuthManagerImpl.listUserOAuth2AuthenticationProviders() filters the same way, so listOauthProvider no longer reports a disallowed provider as enabled.
  • Match is case-insensitive, consistent with how provider names are looked up elsewhere in this class.

Added test coverage for the allow-list check itself and for both call sites.

@Damans227

Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.65%. Comparing base (e201213) to head (2ad135a).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...pache/cloudstack/oauth2/OAuth2AuthManagerImpl.java 72.22% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13866      +/-   ##
============================================
+ Coverage     19.64%   19.65%   +0.01%     
- Complexity    19785    19803      +18     
============================================
  Files          6368     6368              
  Lines        574889   574905      +16     
  Branches      70353    70358       +5     
============================================
+ Hits         112935   112996      +61     
+ Misses       449683   449635      -48     
- Partials      12271    12274       +3     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests 20.93% <72.22%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18841

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.

Global setting oauth2.plugins

3 participants