Skip to content

Default OIDC and Google connections to openid email profile scopes - #4324

Merged
JayaShakthi97 merged 1 commit into
thunder-id:mainfrom
JayaShakthi97:fix/default-oidc-connection-scopes
Jul 27, 2026
Merged

Default OIDC and Google connections to openid email profile scopes#4324
JayaShakthi97 merged 1 commit into
thunder-id:mainfrom
JayaShakthi97:fix/default-oidc-connection-scopes

Conversation

@JayaShakthi97

@JayaShakthi97 JayaShakthi97 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Purpose

Connections created without an explicit scopes property only received the bare openid scope, even for OIDC and Google. This left the email and profile claims unavailable until an admin added them manually, even though the docs already describe openid email profile as the expected scopes for a Google connection.

Approach

Default OIDC and Google connections to openid email profile when no scopes are supplied, while still only ensuring openid is present when the caller provides their own scope list (existing scopes are never force-extended with email/profile). OAuth and GitHub connections are unaffected, since they don't use OIDC scopes.

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
    • Ran Vale and fixed all errors and warnings
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Summary by CodeRabbit

  • Bug Fixes
    • OIDC and Google connections now default to the standard scopes: openid,email,profile when no scopes are provided.
    • Existing custom scopes are preserved, and required scope inclusion behavior is now aligned with the full default scope set.

@JayaShakthi97 JayaShakthi97 changed the title Default OIDC and Google connections to openid email profile scopes Default OIDC and Google connections to openid email profile scopes Jul 24, 2026
@JayaShakthi97 JayaShakthi97 added Type/Bug skip-changelog Skip generating changelog for a particular PR labels Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e11967f-31f4-49d8-9f35-9e5a359b2a99

📥 Commits

Reviewing files that changed from the base of the PR and between cb1a43f and 641ed62.

📒 Files selected for processing (3)
  • backend/internal/idp/constants.go
  • backend/internal/idp/utils.go
  • backend/internal/idp/utils_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • backend/internal/idp/constants.go
  • backend/internal/idp/utils_test.go
  • backend/internal/idp/utils.go

📝 Walkthrough

Walkthrough

OIDC and Google connections now use openid,email,profile when scopes are absent or empty. Tests update expectations for default, empty, and whitespace scope cases.

Changes

OIDC scope defaults

Layer / File(s) Summary
Default scope handling and validation
backend/internal/idp/constants.go, backend/internal/idp/utils.go, backend/internal/idp/utils_test.go
Adds the shared openid,email,profile default, applies it when scopes are missing or empty, and updates related tests to require the complete scope string.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: thamindudilshan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: defaulting OIDC and Google connections to the expected scopes.
Description check ✅ Passed The description follows the template and includes purpose, approach, related issues, checklist, and security checks.
Linked Issues check ✅ Passed The changes implement #4320 by defaulting OIDC/Google scopes to openid,email,profile when none are provided.
Out of Scope Changes check ✅ Passed The edits are limited to the scope-default logic and matching tests, with no unrelated changes introduced.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JayaShakthi97
JayaShakthi97 force-pushed the fix/default-oidc-connection-scopes branch from 9b69192 to cb1a43f Compare July 27, 2026 04:36
@JayaShakthi97 JayaShakthi97 added the trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes label Jul 27, 2026
@JayaShakthi97
JayaShakthi97 enabled auto-merge July 27, 2026 06:11
Connections created without an explicit scopes property only received
the bare openid scope, leaving the email and profile claims
unavailable until an admin added them manually. Seed the full standard
OIDC scope set when none is supplied, while still only ensuring openid
is present when the caller provides their own scopes. OAuth and GitHub
connections are unaffected since they don't use OIDC scopes.
@JayaShakthi97
JayaShakthi97 force-pushed the fix/default-oidc-connection-scopes branch from cb1a43f to 641ed62 Compare July 27, 2026 07:12
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

)

// defaultOIDCScopes is seeded for OIDC and Google connections when no scopes are supplied.
const defaultOIDCScopes = "openid,email,profile"

@ThaminduDilshan ThaminduDilshan Jul 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add email and profile for all the oidc providers or should it be only for known ones like Google?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is valid for Google and Custom OIDC providers and is gated by IdP type. When we are bringing new IdPs (not custom), we can update the gate to selectively provide default scopes to them.
Every mainstream OIDC platform supports these three, hence keeping for custom OIDC providers is fine IMO.

@JayaShakthi97
JayaShakthi97 added this pull request to the merge queue Jul 27, 2026
Merged via the queue into thunder-id:main with commit 586dc49 Jul 27, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Skip generating changelog for a particular PR trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes Type/Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default OIDC/Google connections to openid email profile scopes

2 participants