yard / brave-csp
Content Security Policy for Brave sites
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 3
Type:package
pkg:composer/yard/brave-csp
Requires
- php: >=8.1
- spatie/laravel-csp: ^2.0
Requires (Dev)
- yard/php-cs-fixer-rules: ^1.0
README
Installation
composer require yard/brave-csp
Features
This repository contains a basic Content Security Policy (CSP):
Yard\Csp\Policies\Basic::class
This Policy extends:
Spatie\Csp\Policies\Policy::class
Usage
This policy can be registered in the csp config file provided by the spatie/laravel-csp package:
<?php declare(strict_types=1); return [ /* * A policy will determine which CSP headers will be set. A valid CSP policy is * any class that extends `Spatie\Csp\Policies\Policy` */ 'policy' => Yard\Csp\Policies\Basic::class, ... ];
It can also be extended to create a custom policy:
<?php declare(strict_types=1); namespace App\Csp; use Yard\Csp\Policies\Basic; class Policy extends Basic { public function configure() { parent::configure(); // Add site specific csp directives below } }
In this case the policy config should point to this custom policy:
<?php declare(strict_types=1); return [ /* * A policy will determine which CSP headers will be set. A valid CSP policy is * any class that extends `Spatie\Csp\Policies\Policy` */ 'policy' => App\Csp\Policy::class, ... ];