Skip to content

Enable Content-Security-Policy header #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marcusziade
Copy link

This commit addresses issue #32 by enabling the CSP header in enforcement mode.

While the issue mentions a CSP-Report-Only header currently in use, this could not be found in the codebase. The CloudFormation template contains a commented-out CSP configuration which has been enabled and updated to support the current implementation.

Changes:

  • Uncommented the ContentSecurityPolicy configuration in stack.yaml
  • Added 'unsafe-inline' to script-src and style-src for existing inline code
  • Added connect-src, base-uri, and form-action directives for additional security

The resulting CSP policy:
default-src 'none' script-src 'self' 'unsafe-inline' img-src 'self' style-src 'self' 'unsafe-inline' font-src 'self' connect-src 'self' base-uri 'self' form-action 'self'

Close #32

This commit addresses issue vapor#32 by enabling the CSP header in enforcement mode.

While the issue mentions a CSP-Report-Only header currently in use, this could
not be found in the codebase. The CloudFormation template contains a commented-out
CSP configuration which has been enabled and updated to support the current
implementation.

Changes:
- Uncommented the ContentSecurityPolicy configuration in stack.yaml
- Added 'unsafe-inline' to script-src and style-src for existing inline code
- Added connect-src, base-uri, and form-action directives for additional security

The resulting CSP policy:
  default-src 'none'
  script-src 'self' 'unsafe-inline'
  img-src 'self'
  style-src 'self' 'unsafe-inline'
  font-src 'self'
  connect-src 'self'
  base-uri 'self'
  form-action 'self'

Closes vapor#32
@marcusziade marcusziade marked this pull request as ready for review June 27, 2025 18:02
@marcusziade marcusziade requested review from 0xTim and gwynne as code owners June 27, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CSP Header
1 participant