Labels: area:backend, priority:high, security
Difficulty: Easy
Effort: 0.25 day
Dependencies: None
Problem Statement
Backend responses do not include a baseline of HTTPS / hardening headers (e.g. Strict-Transport-Security, X-Content-Type-Options, Referrer-Policy). Browsers are free to MIME-sniff and load the API in risky frames.
Why It Matters
- Closes the gap on several OWASP A05 (Security Misconfiguration) items.
- Browsers will refuse to load the API response in an iframe from another origin (clickjacking protection).
- Adds XSS mitigation for any reflected content rendered from API errors.
Technical Context
backend/src/main.ts uses enableCors but no security headers.
- The frontend is on Vercel, served over HTTPS in production.
Expected Outcome
Express response includes the OWASP-recommended default header set; CSP is configurable but starts as default-src 'self'.
Acceptance Criteria
Implementation Notes
- Configure
helmet({ contentSecurityPolicy: { directives: { 'default-src': ["'self'"], 'img-src': ["'self'", 'data:', 'https://res.cloudinary.com'] }}}).
- Exclude
/swagger paths from CSP via dynamic nonce.
- Tests assert each header is present.
Files / Modules Likely Affected
backend/src/main.ts
backend/src/config/app.config.ts
backend/package.json
References
Imported from local backlog file 007-helmet.md (manual issue #7).
Labels:
area:backend,priority:high,securityDifficulty: Easy
Effort: 0.25 day
Dependencies: None
Problem Statement
Backend responses do not include a baseline of HTTPS / hardening headers (e.g.
Strict-Transport-Security,X-Content-Type-Options,Referrer-Policy). Browsers are free to MIME-sniff and load the API in risky frames.Why It Matters
Technical Context
backend/src/main.tsusesenableCorsbut no security headers.Expected Outcome
Express response includes the OWASP-recommended default header set; CSP is configurable but starts as
default-src 'self'.Acceptance Criteria
@nestjs/platform-expressregistershelmet()middleware.Strict-Transport-Securityset withmax-age=63072000; includeSubDomains; preload.Implementation Notes
helmet({ contentSecurityPolicy: { directives: { 'default-src': ["'self'"], 'img-src': ["'self'", 'data:', 'https://res.cloudinary.com'] }}})./swaggerpaths from CSP via dynamic nonce.Files / Modules Likely Affected
backend/src/main.tsbackend/src/config/app.config.tsbackend/package.jsonReferences
Imported from local backlog file
007-helmet.md(manual issue #7).