Add Content-Security-Policy header to API responses #623

Open
pook wants to merge 59 commits from agent-task/614 into main
Owner

Summary

  • Added Content-Security-Policy: default-src 'none'; frame-ancestors 'none' to the existing security headers middleware
  • The API already had Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, and other security headers via a custom Hono middleware — CSP was the missing piece
  • Updated unit tests to verify all 6 security headers on every response

Test plan

  • TypeScript type-check passes (tsc --noEmit)
  • Unit test updated to assert the new CSP header
  • Verify bun test passes in an AVX-capable environment (CI runner)

🤖 Generated with Claude Code

## Summary - Added `Content-Security-Policy: default-src 'none'; frame-ancestors 'none'` to the existing security headers middleware - The API already had Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, and other security headers via a custom Hono middleware — CSP was the missing piece - Updated unit tests to verify all 6 security headers on every response ## Test plan - [x] TypeScript type-check passes (`tsc --noEmit`) - [x] Unit test updated to assert the new CSP header - [ ] Verify `bun test` passes in an AVX-capable environment (CI runner) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add Content-Security-Policy header to security middleware
Some checks are pending
CI Quality Gate / Lint / Typecheck / Test / Build (pull_request) Waiting to run
7f6af9e7d1
The API was missing CSP headers. Added a restrictive default policy
(default-src 'none'; frame-ancestors 'none') to the existing Hono
security headers middleware. Updated tests to verify all 6 headers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: issue #614 install-and-configure-the-helmet-npm-pac (agent task liancebot614)
Some checks failed
CI Quality Gate / Lint / Typecheck / Test / Build (pull_request) Has been cancelled
49b13baf92
Some checks failed
CI Quality Gate / Lint / Typecheck / Test / Build (pull_request) Has been cancelled
This pull request has changes conflicting with the target branch.
  • .forgejo/workflows/ci.yml
  • bun.lock
  • package.json
  • packages/api/src/db/schema.ts
  • packages/api/src/index.ts
  • packages/api/src/middleware/csrf.ts
  • packages/api/src/middleware/rate-limit.ts
  • packages/api/src/middleware/security-headers.ts
  • packages/api/src/routes/admin.ts
  • packages/api/src/routes/billing.ts
  • packages/api/src/routes/generate-tos.ts
  • packages/api/src/routes/generate.ts
  • packages/api/src/routes/health.ts
  • packages/api/src/routes/questionnaire.ts
  • packages/api/src/services/document-generator.ts
  • packages/api/src/services/llm.ts
  • packages/api/src/templates/index.ts
  • packages/api/tsconfig.json
  • packages/shared/src/types.ts
  • packages/web/src/app/questionnaire/page.tsx
  • packages/web/src/components/documents/DocumentList.tsx
  • packages/web/src/components/questionnaire/ReviewStep.tsx
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin agent-task/614:agent-task/614
git switch agent-task/614
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot!623
No description provided.