fix(relay): address OAuth authorize PR review — security and coverage gaps
Critical:
- Open redirect: validate client_id + redirect_uri before deny/approve
branches; all three outcomes now only redirect to a DB-verified URI
- Store token.hash in oauth_authorization_codes, not token.plaintext,
consistent with session/refresh-token pattern; token endpoint hashes
the presented code before lookup
Important:
- Move response_type check to after redirect_uri validation in GET;
use error_redirect(unsupported_response_type) instead of error_page
- Add response_type field to ConsentForm + hidden input in render_consent_page
- Log client_id and serde error when client_metadata is malformed (GET + POST)
- Fix inaccurate doc comment on post_authorization
Tests: 8 new tests covering open redirect (tampered deny + approve redirect_uri),
XSS escaping (client_name, scope), URL-encoding of special chars in state,
non-S256 method in POST, client_name fallback, invalid action, malformed metadata
Suggestions: update comments on register_oauth_client, store_authorization_code,
and get_single_account_did; add ORDER BY created_at to get_single_account_did
authored by
malpercio.dev
and committed by