mirror of https://github.com/kcal-app/kcal.git
32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Csp\Policies;
|
|
|
|
use Spatie\Csp\Directive;
|
|
use Spatie\Csp\Keyword;
|
|
use Spatie\Csp\Policies\Policy;
|
|
use Spatie\Csp\Scheme;
|
|
|
|
/**
|
|
* Default CSP policy configuration for the application.
|
|
*
|
|
* @see \Spatie\Csp\Policies\Basic
|
|
*/
|
|
class DefaultPolicy extends Policy
|
|
{
|
|
public function configure(): void
|
|
{
|
|
$this
|
|
->addDirective(Directive::BASE, Keyword::SELF)
|
|
->addDirective(Directive::CONNECT, Keyword::SELF)
|
|
->addDirective(Directive::DEFAULT, Keyword::SELF)
|
|
->addDirective(Directive::FORM_ACTION, Keyword::SELF)
|
|
->addDirective(Directive::IMG, [Keyword::SELF, Keyword::UNSAFE_INLINE, Scheme::DATA])
|
|
->addDirective(Directive::MEDIA, Keyword::SELF)
|
|
->addDirective(Directive::OBJECT, Keyword::NONE)
|
|
->addDirective(Directive::SCRIPT, [Keyword::SELF, Keyword::UNSAFE_EVAL, Keyword::UNSAFE_INLINE])
|
|
->addDirective(Directive::STYLE, [Keyword::SELF, Keyword::UNSAFE_INLINE])
|
|
->addDirective(Directive::FRAME, Keyword::NONE);
|
|
}
|
|
}
|