diff --git a/openspec/changes/add-qr-self-registration/design.md b/openspec/changes/add-qr-self-registration/design.md index c0f3261..5ff4fe1 100644 --- a/openspec/changes/add-qr-self-registration/design.md +++ b/openspec/changes/add-qr-self-registration/design.md @@ -83,7 +83,22 @@ Admin: - **"My QR codes" page** `/my-qr`: reached from the header user menu, shown to every staff user, listing the caller's codes. It is not a module, so `ROUTE_MODULES` leaves it unmapped and any signed-in user may open it. - **Companies page (super admin):** a "Privacy notice" editor with the English and Bahasa Malaysia text areas, save, and "last changed by/at". -### 6. Rejected +### 6. Gateway access without a user token (added after the live check) + +mobile-api forwards the caller's JWT to the gateway, and a visitor has none, so the gateway's `JWTAuthFilter` refused every call the public flow makes (401). The gateway is internal only (`docs/deployment.md`), and the earlier sign-in work set the precedent of exact, anchored bypass paths. + +- **Bypass only these, each for one HTTP method, with anchored patterns (no `contains`):** + - GET `/counter/registrationLink/findByToken/<22 url-safe chars>` + - GET `/counter/event/findByUuid/` + - GET `/counter/interest/findByCompany/` + - GET `/counter/eventSalesperson/findByEventUuid/` + - GET `/company/findById/` + - GET `/company//privacyNotice` (the POST that saves a notice still needs a token) + - GET `/user//activeAdminOf/` + - POST `/counter/registration/register` +- **`/user/findById` stays closed.** It returns the whole user record, password hashes included. services-system gets `GET /user/{id}/activeAdminOf/{companyId}`, which answers only `true` or `false` (type A, enabled, same company; false for an unknown user), and the public salesperson check uses it. + +### 7. Rejected - Matching and capture in mobile-api with two counter calls: not atomic, and it races the unique key. - A notice text copied onto every event lead: a version id is enough and keeps rows small. @@ -93,3 +108,4 @@ Admin: - 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 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. diff --git a/openspec/changes/add-qr-self-registration/tasks.md b/openspec/changes/add-qr-self-registration/tasks.md index 7b31985..d124e41 100644 --- a/openspec/changes/add-qr-self-registration/tasks.md +++ b/openspec/changes/add-qr-self-registration/tasks.md @@ -61,6 +61,15 @@ Waves: - Scope: `solvway-mobile-api/src/**` - Verify: `mvn -T 1C -q -pl solvway-mobile-api verify` +- [ ] 4.2 Gateway access for the public flow (decision 6), found by the live check. + - Depends on: 4.1 + - Tests first: + - gateway: each decision-6 path passes without a user token for its method; POST `/company/1/privacyNotice`, GET `/user/findById/1`, POST `/counter/registrationLink/ensure` and a path with an extra segment still get 401; + - services-system: `activeAdminOf` is true only for an enabled type-A user of that company, false otherwise and for an unknown user; + - mobile-api: the public salesperson check uses `activeAdminOf` and never `findById`. + - Scope: `solvway-api-gateway/src/**`, `solvway-services-system/src/**`, `solvway-mobile-api/src/**` + - Verify: `mvn -T 1C -q -pl solvway-api-gateway,solvway-services-system,solvway-mobile-api verify` + ## 5. Portal - [ ] 5.1 Public page, proxy, middleware, event QR card, My QR codes, Companies privacy notice (decision 5).