Download the PHP package silverstripeltd/silverstripe-csp without Composer

On this page you can find all versions of the php package silverstripeltd/silverstripe-csp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-csp

Silverstripe Content Security Policy

Make your site like super secure with CSP headers and SRI tags on your scripts.

This module is not currently supported, it will frequently change and break APIs.

Requirements

Installation

First you install it, then you configure it. Like lego!

Documentation

First you're going to want to create a Policy you'll likely want to extend the Basic policy as a good starting ground.

This will look something like:

You can then start adding in fragments. These are small pieces of code that resemble a CSP for a service. For example YouTube's is:

If you need to add a new fragment or update an existing one please make a pull request to the repo. You've either found a potential issue for all our projects using this, or you're adding a new service which other projects can benefit from

Adding fragments to your policy looks like this (in configure func from above):

Usually you'll define private const FRAGMENTS = [] and add them in there so it's clear at the beginning what fragments you're adding.

To set the report to, we usually use an env var named CSP_REPORT_TO. You can also call $this->reportTo() in your policies configure func if required (perhaps you want the report URI based on the policy applied).

To add the policy to the list of applied policies you'll want to add some yaml config:

In the above we've added it to be checked after the CMS policy that is included by default.

To make the policy report only you can either add the env var CSP_REPORT_ONLY='enabled' or code it in your policy, for example:

Google Tag Manager / Adservices whitelist

Google uses localised regional domains for visitors for image tracker loading, which can pile up report violations with google.com|.co.nz|.com.au etc in your reporting tool. To resolve this and rather than specifying all of Google's listed support domains (see https://www.google.com/supported_domains) A white list config can be set to the GTM fragment to whitelist all https: URLs on the img-src directive, for example:

See also ImagesOverHTTPs::class for more basic cover of https images.

SRI

We also support SRI in this module, you can enable this via yaml:

This will add SRI hashes to resources added through the requirements. It will not do this to the resources added through insertHeadTags. It will also not create this for files that are dynamically created (e.g. tinymce files)

We won't add SRI hashes for external resources, if this is required then you should be adding them in yourself after being provided them by the external resource (we don't do this as we can't control when or how often those are recalculated)

dev/build will clear the SRI records (we keep these to ensure we don't generate them per request). This has been added through the DevBuildExtension

Todo list:

Maintainers

Bugtracker

Bugs are tracked in the issues section of this repository. Before submitting an issue please read over existing issues to ensure yours is unique.

If the issue does look like a new bug:

Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker.

Development and contribution

If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.

License

See License


All versions of silverstripe-csp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
silverstripe/framework Version ^5
silverstripe/cms Version ^5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package silverstripeltd/silverstripe-csp contains the following files

Loading the files please wait ....