Headless pakket src/cms-client met importgrens, formulier dat pas verschijnt als de API antwoordt (anders blijft de mailto-knop), honeypot, idempotentie, token-vernieuwing en property-based tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
3.7 KiB
3.7 KiB
NFR Requirements — contact-form (U4)
| Id | Category | Requirement |
|---|---|---|
| NFR-U4-1 | Security / input | Client-side validation mirrors the API limits (100/254/100/2000, control characters, email regex); the API is authoritative. All API strings are rendered as plain text (no dangerouslySetInnerHTML). |
| NFR-U4-2 | Security / abuse | Honeypot, server-signed token (no client clock), idempotency key; no external captcha provider is loaded (captcha required => mailto fallback). The client never retries automatically except the single token refresh. |
| NFR-U4-3 | Privacy | No form values, token, idempotency key or response bodies in console output, Sentry (events, breadcrumbs, extra) or Umami. Only contact-sent / contact-failed events without data. Privacy sentence below the form (12 months). |
| NFR-U4-4 | Availability / resilience | The form is progressive: if the API is closed, slow or failing, the mailto panel stays. A failed submit keeps the visitor's input and offers retry plus the mail address. Token and submit requests abort after 10 s. |
| NFR-U4-5 | Performance | No request on page load; the token request starts when the contact section nears the viewport. The form code is part of the main bundle (small); no new runtime dependencies. No layout shift when the panel is upgraded (the panel keeps its minimum height). |
| NFR-U4-6 | Accessibility | WCAG 2.1 AA: labels, error association, focus handling, live regions, 44px targets, contrast (tokens already tested), no motion dependency. |
| NFR-U4-7 | Maintainability | src/cms-client/ has no imports from the app (lint-enforced) and is documented as the future package; texts injectable; Dutch defaults. |
| NFR-U4-8 | Testability | Pure functions and the reducer are property/round-trip tested (partial PBT); the client is tested against a mocked fetch that follows the contract; the hook against the client interface. |
| NFR-U4-9 | Compatibility | Works with hash routing, static hosting and the same-origin API path /api/v1/...; VITE_API_BASE_URL stays a local-development override only. |
Security Baseline compliance (extension enabled) — U4 scope
| Rule | Status | Note |
|---|---|---|
| SECURITY-01 | N/A | the frontend stores nothing; message storage and encryption belong to the CMS |
| SECURITY-02 | N/A | no load balancer/gateway defined in this unit (reverse-proxy logging is an Operations item) |
| SECURITY-03 | Compliant | no values/tokens/PII logged; no ad-hoc logging in the form code |
| SECURITY-04 | Open (Infrastructure) | security headers must be set by the web servers, not by the SPA; whether they are set today is unconfirmed (see infrastructure-design.md); must be confirmed or fixed before the contact routes go live |
| SECURITY-05 | Compliant (client side) | validation with allow-list regex and bounds, plain-text rendering; server validation by the API |
| SECURITY-06/07 | N/A | no IAM/network resources in this unit |
| SECURITY-08 | Compliant | only public endpoints are called (explicit public marker on the API); no admin calls from this site |
| SECURITY-09 | Compliant | generic error messages; no stack traces to visitors |
| SECURITY-10 | Compliant | no new runtime dependencies; lock file committed (dev dependency fast-check for tests only) |
| SECURITY-11 | Compliant | API rate limiting, honeypot/token/idempotency; misuse cases in nfr-design-patterns.md |
| SECURITY-12 | N/A | no authentication in this unit |
| SECURITY-13 | Compliant | JSON only with typed parsing; no new external scripts |
| SECURITY-14 | N/A (Operations) | alerting belongs to the Operations phase (undecided) |
| SECURITY-15 | Compliant | every external call has error handling; failure ends in the mailto fallback; global ErrorBoundary exists |