Skip to content

fix(auth): validate Google OAuth token audience - #9214

Merged
Zaimwa9 merged 2 commits into
mainfrom
fix/google-oauth-audience
Dec 2, 2026
Merged

Zaimwa9 merged 2 commits into
mainfrom
fix/google-oauth-audience

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Adds a GOOGLE_OAUTH_CLIENT_ID setting, mirroring GITHUB_CLIENT_ID. Google login now checks the access token belongs to this client and the email is verified. Client ID set in the admin-api task definitions; login is inactive until it's set.

How did you test this code?

Unit tests (valid token, unset client ID, wrong client, unverified email, API errors) and the existing OAuth audit-log test.

@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
docs Ignored Ignored Preview Dec 2, 2026 10:26am UTC
flagsmith-frontend-preview Ignored Ignored Preview Dec 2, 2026 10:26am UTC
flagsmith-frontend-staging Ignored Ignored Preview Dec 2, 2026 10:26am UTC

Request Review

@github-actions github-actions Bot added api Issue related to the REST API docs Documentation updates infrastructure fix and removed infrastructure docs Documentation updates labels Dec 2, 2026
@github-actions github-actions Bot added docs Documentation updates infrastructure fix and removed fix infrastructure docs Documentation updates labels Dec 2, 2026
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.96%. Comparing base (5268794) to head (f75c527).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9214   +/-   ##
=======================================
  Coverage   98.96%   98.96%           
=======================================
  Files        1724     1724           
  Lines       73823    73879   +56     
=======================================
+ Hits        73056    73113   +57     
+ Misses        767      766    -1     

☔ 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.

@Zaimwa9
Zaimwa9 marked this pull request as ready for review December 2, 2026 10:37
@Zaimwa9
Zaimwa9 requested review from a team as code owners December 2, 2026 10:37
@Zaimwa9
Zaimwa9 requested review from bakirFS and gagantrivedi and removed request for a team December 2, 2026 10:37
@github-actions github-actions Bot removed the fix label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-9214 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-9214 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-9214 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith-api:pr-9214 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith:pr-9214 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith-private-cloud:pr-9214 Finished ✅ Results ✅

@github-actions github-actions Bot added the fix label Dec 2, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 9 files

Confidence score: 1/5

  • api/custom_auth/oauth/google.py passes an access token to an endpoint that requires an id_token, so Google login fails for every configured account. Use the access-token tokeninfo endpoint and compare its audience field.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="api/custom_auth/oauth/google.py">

<violation number="1" location="api/custom_auth/oauth/google.py:9">
P0: `get_user_info` supplies an OAuth access token, but this endpoint requires an `id_token`, so Google rejects every configured login. Use the access-token tokeninfo endpoint and compare its `audience` field.</violation>
</file>

This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

Turn on auto-fix | Re-trigger cubic

Comment thread api/custom_auth/oauth/google.py Resolved
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-16 — run #24047 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  58.7 seconds
commit  f75c527
info  🔄 Run: #24047 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #24047 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  34.8 seconds
commit  f75c527
info  🔄 Run: #24047 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #24047 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  35.4 seconds
commit  f75c527
info  🔄 Run: #24047 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #24047 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  31.9 seconds
commit  f75c527
info  🔄 Run: #24047 (attempt 1)

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

31 screenshots compared. See report for details.
View full report

@Zaimwa9
Zaimwa9 merged commit 139faae into main Dec 2, 2026
52 of 54 checks passed
@Zaimwa9
Zaimwa9 deleted the fix/google-oauth-audience branch December 2, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants