PHPackages                             wedevelopnl/silverstripe-csp-custom-scripts - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. wedevelopnl/silverstripe-csp-custom-scripts

AbandonedArchivedSilverstripe-vendormodule[Security](/categories/security)

wedevelopnl/silverstripe-csp-custom-scripts
===========================================

1.0.0(1y ago)04BSD-3-ClausePHP

Since Dec 19Pushed 1y ago6 watchersCompare

[ Source](https://github.com/wedevelopnl/silverstripe-csp-custom-scripts)[ Packagist](https://packagist.org/packages/wedevelopnl/silverstripe-csp-custom-scripts)[ RSS](/packages/wedevelopnl-silverstripe-csp-custom-scripts/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

WeDevelop Silverstripe CSP Custom Scripts
=========================================

[](#wedevelop-silverstripe-csp-custom-scripts)

Description
-----------

[](#description)

This Silverstripe module makes sure that any custom scripts added through Requirements are served from a javascript file. The goal of this is to be able to drop `script-src: 'unsafe-inline'` from your Content-Security-Policy header.

Installation
------------

[](#installation)

```
$ composer require wedevelopnl/silverstripe-csp-custom-scripts
```

Run a dev/build and you should be all set. If you're using `dorsetdigital/silverstripe-enhanced-requirements` read "Compatibility" for further instructions

Compatibility
-------------

[](#compatibility)

If you're using `dorsetdigital/silverstripe-enhanced-requirements` you will have to do the override yourself, extend the Enhanced\_Requirements class and use the trait to inject the CSP code.

`csp.yml`

```
---
Name: csp-enhanced-requirements
After:
  - '#enhanced-requirements'
  - '#csp-requirements'
---
SilverStripe\Core\Injector\Injector:
  SilverStripe\View\Requirements_Backend:
    class: App\View\RequirementsBackend
```

`src/View/RequirementsBackend.php`

```
