-
- Downloads
Allow AppFramework applications to specify a custom CSP header
This change allows AppFramework applications to specify a custom CSP header for example when the default policy is too strict. Furthermore this allows us to partially migrate away from CSS and allowed eval() in our JavaScript components. Legacy ownCloud components will still use the previous policy. Application developers can use this as following in their controllers: ```php $response = new TemplateResponse('activity', 'list', []); $cspHelper = new ContentSecurityPolicyHelper(); $cspHelper->addAllowedScriptDomain('www.owncloud.org'); $response->addHeader('Content-Security-Policy', $cspHelper->getPolicy()); return $response; ``` Fixes https://github.com/owncloud/core/issues/11857 which is a pre-requisite for https://github.com/owncloud/core/issues/13458 and https://github.com/owncloud/core/issues/11925
Showing
- config/config.sample.php 0 additions, 9 deletionsconfig/config.sample.php
- lib/private/response.php 9 additions, 6 deletionslib/private/response.php
- lib/public/appframework/http/contentsecuritypolicy.php 241 additions, 0 deletionslib/public/appframework/http/contentsecuritypolicy.php
- lib/public/appframework/http/response.php 29 additions, 1 deletionlib/public/appframework/http/response.php
- tests/lib/appframework/controller/ControllerTest.php 4 additions, 3 deletionstests/lib/appframework/controller/ControllerTest.php
- tests/lib/appframework/http/ContentSecurityPolicyTest.php 215 additions, 0 deletionstests/lib/appframework/http/ContentSecurityPolicyTest.php
- tests/lib/appframework/http/DataResponseTest.php 4 additions, 1 deletiontests/lib/appframework/http/DataResponseTest.php
- tests/lib/appframework/http/ResponseTest.php 27 additions, 2 deletionstests/lib/appframework/http/ResponseTest.php
Loading
Please register or sign in to comment