Skip to content

OIDC login has no state or PKCE (WEB-006) #268

Open

Description

@LunaUrsa

Moved from REVIEW-ISSUES.md (WEB-006), found in the review of uat at a828e1e on 2026-11-07.

Files: src/utils/keycloak.ts:15, src/pages/appeal.tsx:125, src/pages/appeal.tsx:392
Needs: matching change in the API behind /api/v2/keycloak/token (not in this repo)

Problem. The authorization request sends no state and no code_challenge, and /appeal?code=… exchanges any code it is given. An attacker can log a victim in as the attacker's account (login CSRF). Tokens live in sessionStorage, so any XSS can read them. The avatar URL from the API is put into a CSS url() unescaped (ProfileButton.tsx:142).

Fix. Generate a random state and a PKCE verifier (base64url from crypto.getRandomValues; randomString.ts is not suitable, it emits characters PKCE forbids), store both in sessionStorage, send state + S256 code_challenge, verify state on return and pass code_verifier to the token endpoint. Quote and validate the avatar URL.

Related: #208 (ban appeal fixes) and #266 (WEB-031 (#266), ban-appeal login).

Same files as #267, #286 — Auth (keycloak.ts, ProfileButton.tsx, appeal.tsx). Take them together or one after another.

Activity

  1. added
    Priority: HighP1: real bug or exposure; fix soon
    Status: AvailableReady to pick up; nobody is working on it
    Type: BugSomething is broken or wrong
    Area: AuthKeycloak login and the ban appeal page (keycloak.ts, ProfileButton.tsx, appeal.tsx)
    securitySecurity exposure or hardening
    on Nov 8, 2026
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

    Area: AuthKeycloak login and the ban appeal page (keycloak.ts, ProfileButton.tsx, appeal.tsx)Priority: HighP1: real bug or exposure; fix soonStatus: AvailableReady to pick up; nobody is working on itType: BugSomething is broken or wrongsecuritySecurity exposure or hardening

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions