Skip to content
Snippets Groups Projects
  1. Nov 18, 2020
  2. Mar 25, 2020
  3. Nov 27, 2019
  4. Nov 22, 2019
  5. Oct 21, 2018
  6. Mar 29, 2017
  7. Mar 16, 2017
  8. Oct 24, 2016
    • Lukas Reschke's avatar
      Add support for CSP nonces · 9e663481
      Lukas Reschke authored
      CSP nonces are a feature available with CSP v2. Basically instead of saying "JS resources from the same domain are ok to be served" we now say "Ressources from everywhere are allowed as long as they add a `nonce` attribute to the script tag with the right nonce.
      
      At the moment the nonce is basically just a `<?php p(base64_encode($_['requesttoken'])) ?>`, we have to decode the requesttoken since `:` is not an allowed value in the nonce. So if somebody does on their own include JS files (instead of using the `addScript` public API, they now must also include that attribute.)
      
      IE does currently not implement CSP v2, thus there is a whitelist included that delivers the new CSP v2 policy to newer browsers. Check http://caniuse.com/#feat=contentsecuritypolicy2 for the current browser support list. An alternative approach would be to just add `'unsafe-inline'` as well as `'unsafe-inline'` is ignored by CSPv2 when a nonce is set. But this would make this security feature unusable at all in IE. Not worth it at the moment IMO.
      
      Implementing this offers the following advantages:
      
      1. **Security:** As we host resources from the same domain by design we don't have to worry about 'self' anymore being in the whitelist
      2. **Performance:** We can move oc.js again to inline JS. This makes the loading way quicker as we don't have to load on every load of a new web page a blocking dynamically non-cached JavaScript file.
      
      If you want to toy with CSP see also https://csp-evaluator.withgoogle.com/
      
      
      
      Signed-off-by: default avatarLukas Reschke <lukas@statuscode.ch>
      9e663481
  9. May 20, 2016
    • Joas Schilling's avatar
      Move tests/ to PSR-4 (#24731) · 94ad54ec
      Joas Schilling authored
      * Move a-b to PSR-4
      
      * Move c-d to PSR-4
      
      * Move e+g to PSR-4
      
      * Move h-l to PSR-4
      
      * Move m-r to PSR-4
      
      * Move s-u to PSR-4
      
      * Move files/ to PSR-4
      
      * Move remaining tests to PSR-4
      
      * Remove Test\ from old autoloader
      94ad54ec
  10. May 18, 2016
  11. Jan 28, 2016
    • Lukas Reschke's avatar
      Add public API to give developers the possibility to adjust the global CSP defaults · 809ff5ac
      Lukas Reschke authored
      Allows to inject something into the default content policy. This is for
      example useful when you're injecting Javascript code into a view belonging
      to another controller and cannot modify its Content-Security-Policy itself.
      Note that the adjustment is only applied to applications that use AppFramework
      controllers.
      
      To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`,
      $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`.
      
      To test this add something like the following into an `app.php` of any enabled app:
      ```
      $manager = \OC::$server->getContentSecurityPolicyManager();
      $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false);
      $policy->addAllowedFrameDomain('asdf');
      $policy->addAllowedScriptDomain('yolo.com');
      
      $policy->allowInlineScript(false);
      $manager->addDefaultPolicy($policy);
      $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false);
      $policy->addAllowedFontDomain('yolo.com');
      $manager->addDefaultPolicy($policy);
      
      $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(false);
      $policy->addAllowedFrameDomain('banana.com');
      $manager->addDefaultPolicy($policy);
      ```
      
      If you now open the files app the policy should be:
      
      ```
      Content-Security-Policy:default-src 'none';script-src yolo.com 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src yolo.com 'self';connect-src 'self';media-src 'self';frame-src asdf banana.com 'self'
      ```
      809ff5ac
  12. Sep 29, 2015
  13. Aug 07, 2015
  14. May 20, 2015
  15. Feb 28, 2015
    • Lukas Reschke's avatar
      Add support for 'child-src' directive · b29940d9
      Lukas Reschke authored
      This is required when working with stuff such as PDF.js in the files_pdfviewer application. Opt-in only.
      
      Master change only because the stable CSP policies has a failback that allows nearly anything :see_no_evil:
      b29940d9
  16. Feb 16, 2015
Loading