PHP content-security-policy

a guest May 27th, 2014 380 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   header("Content-Security-Policy: script-src 'self' 'sha256-".base64_encode(hash('sha256', 'console.log("HI");', true))."'");
  3. ?><!DOCTYPE html>
  4. <html>
  5.   <head>
  6.     <title>CSP</title>
  7.     <meta charset="utf-8" />
  8.   </head>
  9.   <body>
  10.     Hello, content-security-policy!
  11.     <script type='text/javascript'>console.log("HI");</script>
  12.   </body>
  13. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand