zendframework / zend-http

Http component from Zend Framework
BSD 3-Clause "New" or "Revised" License
134 stars 85 forks source link

Missing directives in ContentSecurityPolicy (Level 3) #163

Closed MadCat34 closed 5 years ago

MadCat34 commented 5 years ago

Current Zend\Http\Header\ContentSecurityPolicy is too old (CSP 1.0 Header) and should be updated to follow CSP Level 3 (according to https://www.w3.org/TR/CSP/)

So, Some directives are missing in Fetch directive

And some Navigation, Document and Reporting directives are missing.

Code to reproduce the issue

$csp = new ContentSecurityPolicy();
$csp->setDirective('worker-src', ['https://*.google.com', 'http://foo.com']);
$csp->toString();

Expected results

toString() should return "Content-Security-Policy: worker-src https://*.google.com http://foo.com;"

Actual results

Throw a Exception\InvalidArgumentException

MadCat34 commented 5 years ago

I'm working on a PR.