fix(auth): use cryptographic nonce for OAuth state parameter · Issue #127 · flexion/forms-lab · GitHub
Skip to content

fix(auth): use cryptographic nonce for OAuth state parameter #127

Description

@danielnaab

Context

From security audit (#114). The OAuth state parameter (src/entrypoints/app/routes/auth/index.ts:49) is a JSON-encoded { returnTo } value rather than a cryptographic nonce.

While the open redirect protection limits the practical risk, a proper CSRF defense uses a random nonce stored server-side or in a signed cookie.

Action

  • Generate a cryptographic random nonce for the state parameter
  • Store it in a short-lived cookie or server-side
  • Validate it in the callback
  • Include returnTo as part of the signed payload

Severity

Medium — low practical risk due to existing redirect validation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions