urBackend icon indicating copy to clipboard operation
urBackend copied to clipboard

Social OAuth authorization code (rtCode) transmitted as URL query parameter

Open anshul23102 opened this issue 4 months ago • 1 comments

Summary

The social authentication flow passes the OAuth authorization code as a query string parameter (?rtCode=...) rather than in the POST body. Query parameters appear in:

  • Server access logs
  • Browser history
  • Referrer headers sent to third-party scripts on the destination page
  • Proxies and CDN logs

This can expose short-lived but sensitive OAuth codes before they are exchanged for tokens.

Location

apps/public-api/src/routes/userAuth.js and the corresponding controller in userAuth.controller.js.

Impact

  • An attacker who obtains the rtCode before it is consumed can exchange it for an access token and hijack the account.
  • OAuth 2.0 best-practice (RFC 6749 Section 10.5) explicitly warns against transmitting authorization codes in URLs.

Suggested Fix

Accept rtCode exclusively via a POST request body:

// Instead of GET /auth/social?rtCode=...
// Use POST /auth/social with body { rtCode: '...' }
router.post('/social', asyncHandler(socialAuthController));

anshul23102 avatar Jul 31 '26 11:07 anshul23102

@geturbackend Could you please assign this issue to me? I'd like to work on it under GSSoC '26. /assign /claim

anshul23102 avatar Jul 31 '26 11:07 anshul23102