Skip to content

feat: Enable Content Security Policy (CSP) - #4502

Open
jekkos wants to merge 2 commits into
masterfrom
feat-4488-enable-csp
Open

feat: Enable Content Security Policy (CSP)#4502
jekkos wants to merge 2 commits into
masterfrom
feat-4488-enable-csp

Conversation

@jekkos

@jekkos jekkos commented Apr 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Enables Content Security Policy by setting $CSPEnabled = true in app/Config/App.php
  • CSP directives are already properly configured in app/Config/ContentSecurityPolicy.php
  • Includes support for CSP 3 keywords and directives

CSP Configuration

The existing ContentSecurityPolicy.php includes:

  • defaultSrc with self and www.google.com
  • scriptSrc with self, unsafe-inline, unsafe-eval, and Google domains
  • styleSrc with self, unsafe-inline, and nonce support
  • imageSrc with self, data:, blob:
  • connectSrc with self and nominatim.openstreetmap.org
  • fontSrc with Google Fonts domains

Notes

  • The unsafe-inline in scriptSrc allows existing inline scripts to work during transition
  • Future work can move inline scripts to external files or use nonce attributes
  • CSP provides protection against XSS attacks by restricting resource sources

Related

Closes #4488

Summary by CodeRabbit

  • Security
    • Content Security Policy is now enabled by default to help protect against unauthorized script and resource execution.

Ollama and others added 2 commits April 15, 2026 12:05
- Enable $CSPEnabled = true in app/Config/App.php
- CSP directives already configured in ContentSecurityPolicy.php
- Includes support for CSP 3 keywords and directives

Closes #4488
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a31ff9cb-a2b4-4878-8818-b1c3057b5b28

📥 Commits

Reviewing files that changed from the base of the PR and between 6e273a2 and 5e7873d.

📒 Files selected for processing (1)
  • app/Config/App.php

📝 Walkthrough

Walkthrough

The application configuration now enables Content Security Policy by default by setting CSPEnabled to true.

Changes

Content Security Policy default

Layer / File(s) Summary
Enable CSP by default
app/Config/App.php
The public $CSPEnabled property now defaults to true.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: objecttothis

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states that the pull request enables Content Security Policy.
Linked Issues check ✅ Passed The change enables CSP in app configuration as required by issue #4488, using the existing CSP 3-compatible configuration.
Out of Scope Changes check ✅ Passed The pull request changes only the CSP enablement flag, which is directly related to issue #4488.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-4488-enable-csp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@objecttothis

Copy link
Copy Markdown
Member

Enabling CSP currently breaks a lot. This PR needs to mitigate those.

image

@objecttothis objecttothis added this to the 3.5.0 milestone Aug 6, 2026
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.

[Enhancement]: Enable CSP 3 support in app config

2 participants