Feat: Add CSP

This commit is contained in:
Björn Fromme
2023-10-25 14:40:36 +02:00
parent c25bde7dad
commit 3e540e215d
5 changed files with 272 additions and 1 deletions
+1
View File
@@ -17,4 +17,5 @@ return [
Oneup\UploaderBundle\OneupUploaderBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
Nelmio\SecurityBundle\NelmioSecurityBundle::class => ['all' => true],
];
+45
View File
@@ -0,0 +1,45 @@
nelmio_security:
# prevents framing of the entire site
clickjacking:
paths:
'^/.*': DENY
# disables content type sniffing for script resources
content_type:
nosniff: true
# forces Microsoft's XSS-Protection with
# its block mode
xss_protection:
enabled: true
mode_block: true
# Send a full URL in the `Referer` header when performing a same-origin request,
# only send the origin of the document to secure destination (HTTPS->HTTPS),
# and send no header to a less secure destination (HTTPS->HTTP).
# If `strict-origin-when-cross-origin` is not supported, use `no-referrer` policy,
# no referrer information is sent along with requests.
referrer_policy:
enabled: true
policies:
- 'no-referrer'
- 'strict-origin-when-cross-origin'
forced_ssl:
hsts_max_age: 31536000
hsts_preload: true
csp:
enabled: true
enforce:
default-src:
- 'self'
img-src:
- 'self'
- 'data:'
style-src:
- 'self'
- 'unsafe-inline'
form-action:
- 'self'
object-src:
- 'none'