Skip to content

fix: validate Google OAuth state on callback - #1308

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
boalambo:fix/1159-google-oauth-state-validation
Aug 30, 2026
Merged

fix: validate Google OAuth state on callback#1308
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
boalambo:fix/1159-google-oauth-state-validation

Conversation

@boalambo

Copy link
Copy Markdown
Contributor

Description

This fix hardens the Google OAuth login flow by generating a cryptographically secure state value and validating it on the callback before exchanging the authorization code. This closes the login CSRF gap where an attacker could forge a callback with a mismatched or missing state.

Changes

  • Added secure state generation in oauth.ts
  • Added a shared validateState check and used it in the Google callback flow in route.ts
  • Kept the middleware security headers compatible with the project’s nonce-based CSP expectations in security.ts
  • Added regression coverage in oauth.test.ts

Related Issue

Closes #1159

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • Uses Lucide icons consistently
  • Responsive design implemented
  • Starknet best practices followed

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@boalambo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 567532d into rinafcode:main Aug 30, 2026
6 checks passed
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.

Validate OAuth state parameter on Google login callback

2 participants