diff --git a/openspec/changes/add-qr-self-registration/design.md b/openspec/changes/add-qr-self-registration/design.md index 5ff4fe1..750b4a2 100644 --- a/openspec/changes/add-qr-self-registration/design.md +++ b/openspec/changes/add-qr-self-registration/design.md @@ -76,7 +76,7 @@ Admin: - **`/r/[token]`:** - A client page built from the existing UI components, mobile first, without the admin shell (no sidebar or header). - States: loading, inactive, form, field errors, too-many, thank-you with "Register another person". - - It uses the proxy `app/api/public/registration/[token]/route.ts` (GET and POST). The proxy sends the visitor IP to mobile-api as `X-Forwarded-For`, keeping any incoming value first. + - It uses the proxy `app/api/public/registration/[token]/route.ts` (GET and POST). The proxy sends the visitor IP to mobile-api as `X-Forwarded-For`, set to the last hop of the incoming header (the address the ingress added, the same rule as `X-Client-Ip`), so a visitor cannot choose their own rate-limit key. - **Event edit page:** a "Registration QR" card with: - the event code and every member's code: QR image (`QRCodeSVG`), the link built from `window.location.origin + /r/`, copy, download PNG (`QRCodeCanvas` → `toDataURL`, file `--qr.png`), and an on/off switch; - a note that the link can be pasted into dynamic-qr for a printed code. @@ -106,6 +106,6 @@ mobile-api forwards the caller's JWT to the gateway, and a visitor has none, so ## Risks - Shared venue NAT: 60 submissions per event per 10 minutes from one IP may still be hit at a very busy booth. The message tells the visitor to try later. Raise the limit if it happens. -- `X-Forwarded-For` is client-controlled unless Traefik overwrites it. Locally there is no proxy. The deployment notes ask that Traefik be set to replace, not append, the header for the portal. +- The visitor IP is the last `X-Forwarded-For` hop, which is right whether Traefik appends to or replaces the header. Behind a second proxy in front of Traefik it would be that proxy's address; the deployment notes say so. - The default notice is a template; INS and CV must review it. - The gateway bypass (decision 6) lets any holder of a gateway api-key read those records and register a lead without a user token. The gateway is not exposed outside the cluster, and the paths are exact, so the exposure is limited to callers that already hold a server api-key.