Conversation
Greptile OverviewGreptile SummaryThis PR upgrades Key ChangesSecurity Fix (v15.0.2)The OAuth2 authorization flow now implements double-submit cookie CSRF protection. When a user initiates OAuth login via Breaking Changes (v15.0.0)
Both breaking changes are already satisfied by this project:
Dependency Updates
Compatibility Analysis✅ Python Version: Project requires ≥3.11, which exceeds fastapi-users v15's requirement of ≥3.10 ✅ Pydantic Version: Project uses Pydantic 2.11.7, compatible with fastapi-users v15's requirement for Pydantic v2 ✅ fastapi-users-db-sqlalchemy: Version 5.0.0 is compatible with fastapi-users ≥10.0.0 (checked ✅ OAuth Implementation: The codebase uses custom OAuth router implementation ( CSRF Cookie ConsiderationsThe new CSRF protection uses cookies that should work out-of-the-box for this application because:
Note: If this application is deployed with a separate frontend domain or uses cross-origin OAuth flows, cookie configuration may need adjustment (domain, SameSite, Secure flags). The fastapi-users documentation mentions this: cross-domain setups may require explicit cookie configuration. Risk Assessment
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant Browser
participant OnyxApp as Onyx Backend
participant OAuthProvider as OAuth Provider (Google/OIDC)
Note over OnyxApp,OAuthProvider: New CSRF Protection in v15.0.2
User->>Browser: Click "Login with OAuth"
Browser->>OnyxApp: GET /auth/oauth/authorize
Note over OnyxApp: Generate state token (JWT)
OnyxApp->>OnyxApp: Set CSRF cookie in response
Note right of OnyxApp: New in v15.0.2:<br/>Double-submit cookie pattern
OnyxApp-->>Browser: 200 OK + CSRF Cookie + Authorization URL
Browser->>OAuthProvider: Redirect to authorization_url
User->>OAuthProvider: Authenticate & Grant Permissions
OAuthProvider-->>Browser: Redirect to callback with code + state
Browser->>OnyxApp: GET /auth/oauth/callback?code=...&state=...
Note right of Browser: Includes CSRF cookie
OnyxApp->>OnyxApp: Verify CSRF cookie matches
Note right of OnyxApp: New validation in v15.0.2:<br/>Cookie must be present<br/>and match state parameter
alt CSRF Cookie Valid
OnyxApp->>OAuthProvider: Exchange code for access_token
OAuthProvider-->>OnyxApp: Return access_token + user info
OnyxApp->>OnyxApp: Create/update user via oauth_callback()
OnyxApp->>OnyxApp: Create session token
OnyxApp-->>Browser: 302 Redirect + Session Cookie
Browser->>User: Logged in successfully
else CSRF Cookie Missing/Invalid
OnyxApp-->>Browser: 400 Bad Request
Browser->>User: Authentication failed
end
|
187d7b3 to
cd9e7d5
Compare
|
@greptile @cubic-dev-ai please re-review |
@jmelahman I have started the AI code review. It will take a few minutes to complete. |
Bumps [fastapi-users](https://github.com/fastapi-users/fastapi-users) from 14.0.1 to 15.0.2. - [Release notes](https://github.com/fastapi-users/fastapi-users/releases) - [Commits](fastapi-users/fastapi-users@v14.0.1...v15.0.2) --- updated-dependencies: - dependency-name: fastapi-users dependency-version: 15.0.2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
75033b0 to
904a67d
Compare
…uirements (#6897) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: justin-tahara <justintahara@gmail.com>
Bumps fastapi-users from 14.0.1 to 15.0.2.
Release notes
Sourced from fastapi-users's releases.
... (truncated)
Commits
1df7c10Bump version 15.0.1 → 15.0.2a8848ecBump pwdlib[argon2,bcrypt] from 0.2.1 to 0.3.0ce42fd7Bump python-multipart from 0.0.20 to 0.0.2132cd433Bump actions/checkout from 5 to 67cf413cAdd a double-submit cookie in the OAuth flowbcee8c9Update README119a5caBump version 15.0.0 → 15.0.1c09b16fFix docstringeaf78f7docs: update .all-contributorsrc [skip ci]b11ad37docs: update README.md [skip ci]You can trigger a rebase of this PR by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)You can disable automated security fix PRs for this repo from the Security Alerts page.
Summary by cubic
Upgrade fastapi-users from 14.0.1 to 15.0.2 and add a double-submit CSRF cookie to the OAuth2 authorize/callback endpoints to address the OAuth CSRF vulnerability.
Dependencies
Migration
Written for commit 1db8517. Summary will update on new commits.