Content Security Policy - PHPUGFFM

Walter Ebert
Walter EbertIndependent Web & Usability Engineer at walter.ebert.engineering
Content Security Policy
Walter Ebert

http://www.flickr.com/photos/murdelta/5963788863/

PHP Usergroup
Frankfurt am Main
21. November 2013
Walter Ebert

@wltrd
walterebert.de
XSS
Cross-Site-Scripting ist eine Art der HTML Injection.
Cross-Site-Scripting tritt dann auf, wenn eine
Webanwendung Daten annimmt, die von einem
Nutzer stammen, und diese Daten dann an einen
Browser weitersendet, ohne den Inhalt zu überprüfen.
Damit ist es einem Angreifer möglich, auch Skripte
indirekt an den Browser des Opfers zu senden und
damit Schadcode auf der Seite des Clients
auszuführen.

https://de.wikipedia.org/wiki/Cross-Site-Scripting
Schützt den Benutzer
Nicht die Anwendung
http://www.phptherightway.com/#security
W3C Content Security Policy
CSP 1.0
http://www.w3.org/TR/CSP/
CSP 1.1 (In Arbeit)
https://dvcs.w3.org/hg/content-security-policy/r
aw-file/tip/csp-specification.dev.html
http://caniuse.com/#search=csp
Konfiguration
Apache
<IfModule mod_headers.c>
Header set Content-Security-Policy "default-src 'self';"
</IfModule>

PHP
header("Content-Security-Policy: default-src 'self';");
$ curl -I http://dev.walterebert.com
HTTP/1.1 200 OK
Date: Sat, 02 Nov 2013 12:49:57 GMT
Server: Apache/2.2.22
X-Powered-By: PHP/5.3.17
Cache-Control: max-age=0
Expires: Sat, 02 Nov 2013 12:49:57 GMT
Content-Security-Policy: default-src 'self';
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Content Security Policy - PHPUGFFM
Reporting
Apache
<IfModule mod_headers.c>
Header set Content-Security-Policy-Report-Only 
"default-src 'self'; report-uri /csp-reporter.php;"
</IfModule>

PHP
header("Content-Security-Policy-Report-Only: default-src 'self';
report-uri /csp-reporter.php;");
csp-reporter.php
<?php
header('HTTP/1.1 204 No Content');
$data = file_get_contents('php://input');
if (is_string($data) and json_decode($data)) {
syslog(LOG_INFO, $data);
}
HTTP POST
{
"csp-report":
{
"document-uri":"http://dev.walterebert.com/",
"referrer":"",
"violated-directive":"default-src 'self' ",
"original-policy":"default-src 'self'; report-uri /csp-reporter.php;",
"blocked-uri":"http://cdn.slidesharecdn.com",
"status-code":200
}
}
Chrome
{"csp-report":{"documenturi":"http://dev.walterebert.com/","referrer":"","violated-directive":"default-src
'self' ","original-policy":"default-src 'self' ; report-uri /cspreporter.php;","blocked-uri":"http://cdn.slidesharecdn.com","status-code":200}}
{"csp-report":{"documenturi":"http://dev.walterebert.com/","referrer":"","violated-directive":"default-src
'self' ","original-policy":"default-src 'self' ; report-uri /cspreporter.php;","blocked-uri":"data","status-code":200}}
{"csp-report":{"documenturi":"http://dev.walterebert.com/","referrer":"","violated-directive":"default-src
'self' ","original-policy":"default-src 'self' ; report-uri /cspreporter.php;","blocked-uri":"","status-code":200}}
Firefox
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"https://cdn.slidesharecdn.com/ss_thumbnails/responsive-design-drupal-meetup-frankfurt-130912115128-phpapp01-thumbnail-2.jpg?1379004938","violated-directive":"default-src http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"https://cdn.slidesharecdn.com/ss_thumbnails/web-performance-optimierung-developer-week-2013-130625082350-phpapp02-thumbnail-2.jpg?1372582510","violated-directive":"default-src
http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"https://cdn.slidesharecdn.com/ss_thumbnails/webperfdays-amsterdam-2013-responsive-video-130519125920-phpapp02-thumbnail-2.jpg?1378556655","violated-directive":"default-src http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"self","violated-directive":"inline script base restriction","source-file":"http://dev.walterebert.com/","script-sample":"n// Responsive menunif (typeof window.ma...","line-number":14}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"https://cdn.slidesharecdn.com/ss_thumbnails/web-performance-drupal-meetup-frankfurt-2013-130314172209-phpapp01-thumbnail-2.jpg?1363299801","violated-directive":"default-src
http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"http://cdn.slidesharecdn.com/ss_thumbnails/responsive-design-drupal-meetup-frankfurt-130912115128-phpapp01-thumbnail-2.jpg?1379004938","violated-directive":"default-src http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"http://cdn.slidesharecdn.com/ss_thumbnails/web-performance-optimierung-developer-week-2013-130625082350-phpapp02-thumbnail-2.jpg?1372582510","violated-directive":"default-src
http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"http://cdn.slidesharecdn.com/ss_thumbnails/webperfdays-amsterdam-2013-responsive-video-130519125920-phpapp02-thumbnail-2.jpg?1378556655","violated-directive":"default-src http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"http://cdn.slidesharecdn.com/ss_thumbnails/web-performance-drupal-meetup-frankfurt-2013-130314172209-phpapp01-thumbnail-2.jpg?1363299801","violated-directive":"default-src http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blockeduri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAWCAMAAAC7dUHMAAAAMFBMVEUFCAMREg8aGxkhIyA6PDlkZmN1bJ+SjbCSlJGcmrCwsbC5tcvIycze3+Hw7/H9//xelZ5BAAABu0lEQVR4AZ3U7crcQAgF4MmomY/xeO7/butMdlta+ufNYVkl4IMBSeF/E3Pyh/lIEQCCfzJ7vJHCV2ttuH+12OWNhJUGHm6B5FpvJXcPtPu+txVku/2NFGsMDz5Oy54r+xdSrNZWA
F8o1b1d/FxKYmEivtDESggvdhoJjRWxPpCfHWMxupn1gGWc3XyaISvZVU+XcXrvIGYUtuZjOJy+Mh4+HXutgF4qxbyI1gtWZy9lUivnpXpJWBb1WUQU3lG41mgNGPEcqCfY7kxKiimCYrTiJrOLGDUJcZruJyS7zV5meBRiv1b4cAJbSvhITCmHNaWpGltSE6hAFAyEVes9IrhlsjDaIw3Q5/LknhBWRUr3UmvtPFKXviUDM3ZlQM5q/Ej3vaVD5X97kpKK9Ukv1lWPJK6akn52ko4DafwlPdftG7
l3yDPBLdFKHAldRHZLveYuBwIf6Vx0oG0KxAda/0g4kkOq5LBIVdpVa3Gpic9HQg4izjLnkA4VZPQeJGGT3Tx/8zkicqpaZJuB7fgj0e97cGwqG3Bbb78F5w7vdHaak8GXEnGv5J4c67XEWBHrNxTvpSdYo613TOYXgZ5KQK6spScAAAAASUVORK5CYII=","violated-directive":"default-src http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blockeduri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAyCAMAAAAnSAbsAAAAMFBMVEUJb5U3g6NVlrHnkiJ2qb/rp025vLqlxtTvunTJy8nzyJLY4uX44MPu8vL78OP9//xCc7hCAAACiElEQVR4Ae3X4ZKrKBAFYEC0g4dDv//bbjcYNLPJbqqcn3PuVRpKvrQxlZkJ+lv5k2Yowt+RcopRyN+QhBJTFvCuhASlSIrCm5JKppIqKeOmpAkqosqccFNyRnRQ9yQkjoI585akC
dOUe5LMViThlqRxNpXzPensRBLvSbNCljsS86XMvCEhKzFvT+5ISXN619SQCBxLpJJHDX0TRo3x0hReJBYABAFYtfkJaoW+S5Ig+clKzsIXSYmylVJgx+blxu2DhByZRU9LcJU8JkF9ZNm2z5KKKISnLIIpKQpoB6h2wE5uAvoxACeUo/DGz5b5VHLKWfjm2SlndaaNvK7Vpq/fU2FMkwwAszy3PEb21vZLue7PDcIpIYYQRT05hJBfpLos67F9P8plebTH8phvlHBKBo39iFalq9R22zaij2WtXh
h+Sm7hlGIOEb2llEySLEfr2SU9shra9WWpF0nJiyQpiBV2Nox2qEdC5L6se7W0U9KzpzNTkpCgEiN+Su2xLqunficBMYoJmT8lbdXjyneSKxKD6L+kEbvJLpnbfkh1r1dJJfqbjf+Qel9O1CG159Pd93aVkEIIwi5JCClbkkl17Vlsp3+evFqtv+q1Z69XKSaoSgxjyKSk2BOib/esdnXbjemp/tEf0qPa3T0lAuxnjInjPdmfXe1pfnEbE+/JJyNefPwugIxYl/ombX/UL39/MmIkQd/Fuvg/ibz
2BFC/zfz2hXIrVmyFqnZQNz3jV/RlC8bBoh7gVfL9sLCwWLZxmqGir2z2fww+O/71SZeGXIYE9h39bP6xBWprG3yJNud4FRT4CJTCsye72m/Mi759vLqPPpAFxyu4pEMy49kT//4C+j7/AAp/ttcmKUUDAAAAAElFTkSuQmCC","violated-directive":"default-src http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blockeduri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAABECAMAAAD6M+gwAAAAwFBMVEXt7PDc29+Wj7LDv9ODfKWMhqyWkLOgm7p6dJ9wa5lnY5S3tsNZV4tMS4RLS4RLS4NMTIStrbnPz9Tx8fLp6eq8vcTCw8ioqrKytLuKjpmIjJeMkJucn6ianaafoqujpq5/hJCBhpKUmKKSlqCRlZ+Pk512fImFipWXm6SUmKF5f4t8go5udYJxeIVzeoZkbXpmb3xocX5rc39vd4Ntd
YFgandrdIBbZnNTYG5JWWhOXWtQX21JWmhJWWdKWmj///
+KYSnGAAAGvklEQVR4AazSzW6jMBTF8bDOChPA+QgBB3CKGSZJq6wqnfd/q7k+IGxFnV1/uN1U+uvat5vv37L5xu/wpVtwXpyC6lRFLnLelMSSMebD0Bpcmqe3aEyKVZRlqRXX9nr9EAyGKK1Z8d9RWeoW7ey6MGv3p+tLU5dRk6X9cbEmOx+MqmxS1NRImZSmdOfSgrUQfR+1fYsWSKNRWbLWHg5yDvvgp2a7YrNAGb0qS41dHfNVt+/yBJm6+FxO+tyR0XmRyx9LRjmpmUuRHIutvWWAHCgZEYv
CZ3WG2SUalqU6aBouO0HSdBlUa22ZIbcWiawnLZgtAZXKf5DCJXoAllxQU4nM1gWKxjMZugaJ9WTMyu6QHrwcVfSoLA0RJ2Sam3MZqnkrCmkD1ZDG9sSq2EpVgpbZPUs9DYP8eE0CLUkEuoaq6YxtiW1DW5xswNLk9asCapAmdlqQcVCObtCVhEVTa5ybgKU/3uQ/r8TG9WIHO496vNaDxMlAd9jxRZ3GrXb1bCmN4/hJvmgBy2YKxUkrZK6H8tF+uEIPCoU03aBhXMDS8/lF4/g1yihJ6vV9gsQM
hxSopkmqvddC9/tsvriCCWsaWHo8gwKLfJSUtznJpFC8/9QhnaaDwqztiati6X6/P+4PGsrV8HzdcqUqJ7OOeztfvz/W0p0OJvWaaFUs/fXuswd/URj19ZL7v/gA4lM+X5UjOKpYS6v70mSQUXrKWbsSZfUf2eTT3CoOBPHlvKel2CG+2FgHV7FPMfvHLmlId/T9v9WOBgGv6k0lMKqIX3dLk1rbTf336aT3USnndQVZf9avnNKJdWajnnU6dVIyhEFWQglWjqK+lcR3TofX8wR+zf/vRjIK/Dsih
TAxzmGecLc2M8zzdXrfnsvN6vm8LX/fxtvt8RjH6+Nnq076QtWHg4b+OjIMIldKJ8MI6QaZWB7v0vf9X3c71NL1/Y976bvfnuZyN+okkNgiYe7qYhaQlIAgVFtAS0R5pPSe7FDL9H4v9/L+p7stR70bCcR2QKMARjJPd4iE/ncwCOikXoSfJScz98f7hyE/
+v2evr7hpMqwIpTXjdSFEC1dXxLcFyppDDNioVpzXz/Lmv+UdV2/3YRuJHjvni5DBtnSzXmYgFlIlpfBiEqynmQsyMNMl/c8TqKjUCsPnXygnXjg2JHBSLCvjUQn1ZjLq8jQZTpKAbB5UrCy1FDTvGiKr7hgScwxIy0gXxnWAjkazSpn25IrhfTp0zMdsB+7c7HJwYsutHfeqG774YvdE7VNdftjG3DdXqcC4OtTgrWa7D5PTYn5FWNCXsAIYLEEvlgSUlJ4aFq4mjvGXYeKRnLOph0HkQmxRBZFG
EaJjAJIjzBrHakrUGwLY5Fu3D3p7kmVaK5jH2M2UpcLYUwSUVRlmEMgy8UMs8RX3aIXaWfrUZ10zICyelrwsiEoQB+lzHwJKJfysXm6g8W28FVKqULtqrSR9njwKLRnGgpVZkowLCAxlFDduDp9sNBN7TqB4+683GeVmo3ESwEeQz9cYAtKZF/TlSIKe4aaburaBIBK7unaIJ3m2gXUfl+2SXHFfRzoAQ/S9unG2vf6u71clo7yLbBGNwaOSW6eToZW/uED1NMnmoD/NtCG4UE6ZxVNWnH2B2PPcq
ZCC/nLFDRz3pz/ibqZRavmhfy/
+bJLUhyGgfCMAxkM+VoNF9L9b7VjKbM/7zysUsFyIn0ltSgXVDnl1Oze+w/IBgsC5MCoXBkbtK76sEWtWHYAePlSWEWSjDCLZUf5RpZ1urQVn+KFARncEfFmklFdIZpoeWUhCfdb6BAwqjh6rQzZXVOcOlmtkCsm3AIpWjA6sTN7J3WuRJHqRXQTQiE49jGuh45x+XYvzDH2i3GIfXz7igK5qBK4SSWG3RRV9bN+zR0zN617X9snJu65DCr6LKsqKBLLNSFCasku+bx95LzlF+ve8rpnSvbMx5yzy
hOyg2pCTbIoW6uLpZH78ZH3kdvYcrDlcctPJF9zG7eSsED08ODUKWr+rWiP+rl6ePkrl11Uyy4FY3nX0sHhv8bbJGgOCve7LV/b81hdzVdO8mPbVjo65nzkzmndzD+K94CLWPaZWtxXHtqyhO9vA5f78ciB1SoYWTY+FSekKL67dWVqeZnhTGY+HeDg6JlScqMAu/ppUtURDgI5lqtxAeRxxWPnPiZVhI/x2MYBUsv9u5Um1dalVZRQ4J6BK7CgyyBqWxSLhhCyfkjEusPh5ViWO7xzl19Qucj9eL
knTbhJJV1ZV/QTofOBKqvq6F1xLfhzKvy3J93bzvF32S+y3QFX1EqmJQAAAABJRU5ErkJggg==","violated-directive":"default-src http://dev.walterebert.com:80"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"self","violated-directive":"inline script base restriction","source-file":"http://dev.walterebert.com/","script-sample":"ntif (typeof window.matchMedia === "unde...","line-number":266}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"self","violated-directive":"inline script base restriction","source-file":"http://dev.walterebert.com/","script-sample":"n/* Modernizr 2.6.2 (Custom Build) | MIT...","line-number":274}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}}
{"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"self","violated-directive":"inline script base restriction","source-file":"http://dev.walterebert.com/","script-sample":"try { for(var lastpass_iter=0; lastpass..."}}
Direktiven
default-src : Alle Ressourcen
img-src : Bilder
style-src : Stylesheets
media-src : Audio + Video
frame-src : iframes
connect-src : AJAX, WebSockets, EventSource
font-src : Schriften
object-src : Flash, Java, usw.
Keywords
* : Alles erlauben
'none' : Nichts erlauben
'self ' : Nur Ursprungsdomain (nicht Subdomains)
'unsafe-inline' : Inline JavaScript + CSS
'unsafe-eval ' : JavaScript eval()
Beispiele
# Lokal + Inline CSS/JS + Data URI
default-src 'self'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data:;
# Lokal + CDN
default-src 'self' *.amazonaws.com;
# Lokal + Bilder von Überall
default-src 'self'; img-src: *;
# Nur SSL
default-src https:;
# Explizite Freigaben
default-src 'none'; style-src 'self'; script-src 'self'; img-src 'self';
Browserunterschiede
Firefox
default-src 'self'; script-src 'unsafe-inline';

Chrome
default-src 'self'; script-src 'self' 'unsafe-inline';
$ curl -I http://walterebert.com
HTTP/1.1 200 OK
Date: Mon, 18 Nov 2013 19:38:14 GMT
Server: Apache
Cache-Control: max-age=0, no-cache
Content-Security-Policy: default-src 'self'; img-src data: http:
https: *.slidesharecdn.com *.slideshare.net; script-src 'self'
'unsafe-inline'; style-src 'self' 'unsafe-inline'; report-uri /cspreporter.php;
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Beispiele blockierter URIs
mx://res/reader-mode/reader.html
chromenull://
chromeinvoke://1fb8adb44a3b9f7b1671bf5082dbf486
chromeinvokeimmediate://95dc806b80bec27e456ff17770b82cf8
chrome-extension://noojglkidnpfjbincgijbaiedldjfbhh
android-webview
safari-extension://com.wotservicesoy.wot-ff6ww26hl3
safari-extension://com.avast.wrc-6h4hrtu5e3
moz-icon://noscript?size=32&contentType=video/ogg
http://cdncache-a.akamaihd.net
https://d3ijcis4e2ziok.cloudfront.net
https://translate.googleapis.com
Walter Ebert

@wltrd
walterebert.de
walterebert.com
slideshare.net/walterebert
DrupalCamp Frankfurt, 12.-13. April 2014
drupal-am-main.de
Referenzen
http://content-security-policy.com/
https://www.owasp.org/index.php/Content_Security_Policy
http://www.html5rocks.com/en/tutorials/security/content-secur
ity-policy/
https://developer.mozilla.org/en-US/docs/Security/CSP
http://caniuse.com/#search=csp
http://mathiasbynens.be/notes/csp-reports
http://www.w3.org/TR/CSP/
https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp
-specification.dev.html
1 of 23

Recommended

Xss by
XssXss
XssRajendra Dangwal
920 views15 slides
XSS Injection Vulnerabilities by
XSS Injection VulnerabilitiesXSS Injection Vulnerabilities
XSS Injection VulnerabilitiesMindfire Solutions
3.5K views20 slides
Cross site scripting by
Cross site scriptingCross site scripting
Cross site scriptingn|u - The Open Security Community
2.9K views15 slides
XSS- an application security vulnerability by
XSS-   an application security vulnerabilityXSS-   an application security vulnerability
XSS- an application security vulnerabilitySoumyasanto Sen
1.2K views42 slides
Cross site scripting (xss) by
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)Ritesh Gupta
1.3K views22 slides
Cross site scripting by
Cross site scriptingCross site scripting
Cross site scriptingashutosh rai
586 views17 slides

More Related Content

What's hot

Cross site scripting attacks and defenses by
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defensesMohammed A. Imran
17.6K views45 slides
Deep understanding on Cross-Site Scripting and SQL Injection by
Deep understanding on Cross-Site Scripting and SQL InjectionDeep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionVishal Kumar
2.8K views38 slides
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar by
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharCross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharSandeep Kumbhar
244 views16 slides
Cross Site Scripting (XSS) by
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Barrel Software
1.7K views27 slides
Cross site scripting (xss) by
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)Manish Kumar
1.5K views16 slides
Reflective and Stored XSS- Cross Site Scripting by
Reflective and Stored XSS- Cross Site ScriptingReflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site ScriptingInMobi Technology
4.1K views29 slides

What's hot(20)

Cross site scripting attacks and defenses by Mohammed A. Imran
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defenses
Mohammed A. Imran17.6K views
Deep understanding on Cross-Site Scripting and SQL Injection by Vishal Kumar
Deep understanding on Cross-Site Scripting and SQL InjectionDeep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL Injection
Vishal Kumar2.8K views
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar by Sandeep Kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharCross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Sandeep Kumbhar244 views
Cross site scripting (xss) by Manish Kumar
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)
Manish Kumar1.5K views
Reflective and Stored XSS- Cross Site Scripting by InMobi Technology
Reflective and Stored XSS- Cross Site ScriptingReflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology4.1K views
Cross Site Scripting Defense Presentation by Ikhade Maro Igbape
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape3.7K views
Xss what the heck-! by VodqaBLR
Xss   what the heck-!Xss   what the heck-!
Xss what the heck-!
VodqaBLR662 views
XSS-Alert-Pentration testing tool by Arjun Jain
XSS-Alert-Pentration testing toolXSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing tool
Arjun Jain7.7K views
Cross Site Scripting(XSS) by Nabin Dutta
Cross Site Scripting(XSS)Cross Site Scripting(XSS)
Cross Site Scripting(XSS)
Nabin Dutta518 views
The Cross Site Scripting Guide by Daisuke_Dan
The Cross Site Scripting GuideThe Cross Site Scripting Guide
The Cross Site Scripting Guide
Daisuke_Dan2.3K views
Identifying Cross Site Scripting Vulnerabilities in Web Applications by Porfirio Tramontana
Identifying Cross Site Scripting Vulnerabilities in Web ApplicationsIdentifying Cross Site Scripting Vulnerabilities in Web Applications
Identifying Cross Site Scripting Vulnerabilities in Web Applications
Porfirio Tramontana18.4K views
Cross-Site Scripting (XSS) by Daniel Tumser
Cross-Site Scripting (XSS)Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)
Daniel Tumser4.9K views
Cross site scripting by kinish kumar
Cross site scriptingCross site scripting
Cross site scripting
kinish kumar30.1K views
Understanding dom based xss by Potato
Understanding dom based xssUnderstanding dom based xss
Understanding dom based xss
Potato568 views
4774.projectb.securitysquad by Josh Howell
4774.projectb.securitysquad4774.projectb.securitysquad
4774.projectb.securitysquad
Josh Howell325 views

Viewers also liked

Campixx 2012-ladezeit-extreme by
Campixx 2012-ladezeit-extremeCampixx 2012-ladezeit-extreme
Campixx 2012-ladezeit-extremeAlexander Merkel
890 views28 slides
PHP Kongress 2010 - Web-Performance by
PHP Kongress 2010 - Web-PerformancePHP Kongress 2010 - Web-Performance
PHP Kongress 2010 - Web-PerformanceNico Steiner
1K views117 slides
Social media and crisis communication by
Social media and crisis communicationSocial media and crisis communication
Social media and crisis communicationUlrich Gartner
3.5K views39 slides
Seo Campixx 2015 - Technical SEO for Beginners by
Seo Campixx 2015 - Technical SEO for BeginnersSeo Campixx 2015 - Technical SEO for Beginners
Seo Campixx 2015 - Technical SEO for BeginnersJan Berens
6.8K views59 slides
Webhacks am Beispiel PHP + MySQL by
Webhacks am Beispiel PHP + MySQLWebhacks am Beispiel PHP + MySQL
Webhacks am Beispiel PHP + MySQLTorben Brodt
36.1K views13 slides
Leitfaden Facebook Marketing: Fanseiten 2011 by
Leitfaden Facebook Marketing: Fanseiten 2011Leitfaden Facebook Marketing: Fanseiten 2011
Leitfaden Facebook Marketing: Fanseiten 2011Futurebiz
4.6K views29 slides

Viewers also liked(20)

PHP Kongress 2010 - Web-Performance by Nico Steiner
PHP Kongress 2010 - Web-PerformancePHP Kongress 2010 - Web-Performance
PHP Kongress 2010 - Web-Performance
Nico Steiner1K views
Social media and crisis communication by Ulrich Gartner
Social media and crisis communicationSocial media and crisis communication
Social media and crisis communication
Ulrich Gartner3.5K views
Seo Campixx 2015 - Technical SEO for Beginners by Jan Berens
Seo Campixx 2015 - Technical SEO for BeginnersSeo Campixx 2015 - Technical SEO for Beginners
Seo Campixx 2015 - Technical SEO for Beginners
Jan Berens6.8K views
Webhacks am Beispiel PHP + MySQL by Torben Brodt
Webhacks am Beispiel PHP + MySQLWebhacks am Beispiel PHP + MySQL
Webhacks am Beispiel PHP + MySQL
Torben Brodt36.1K views
Leitfaden Facebook Marketing: Fanseiten 2011 by Futurebiz
Leitfaden Facebook Marketing: Fanseiten 2011Leitfaden Facebook Marketing: Fanseiten 2011
Leitfaden Facebook Marketing: Fanseiten 2011
Futurebiz4.6K views
Das (noch) nicht genutzte Potential von E-Books by Rudolf Mumenthaler
Das (noch) nicht genutzte Potential von E-BooksDas (noch) nicht genutzte Potential von E-Books
Das (noch) nicht genutzte Potential von E-Books
Rudolf Mumenthaler4.5K views
Above the fold content by Walter Ebert
Above the fold contentAbove the fold content
Above the fold content
Walter Ebert7.5K views
Einführung in WAI-ARIA by Stefan Walter
Einführung in WAI-ARIAEinführung in WAI-ARIA
Einführung in WAI-ARIA
Stefan Walter2.7K views
Campixx 2014 | Case Study - SEO für eine Ferienwohnung by Heiko Hoehn
Campixx 2014 | Case Study - SEO für eine Ferienwohnung Campixx 2014 | Case Study - SEO für eine Ferienwohnung
Campixx 2014 | Case Study - SEO für eine Ferienwohnung
Heiko Hoehn2K views
Web Performance Optimierung - DWX13 by Walter Ebert
Web Performance Optimierung - DWX13Web Performance Optimierung - DWX13
Web Performance Optimierung - DWX13
Walter Ebert7.9K views
Bilder einbinden ist kein Thema, oder? by Walter Ebert
Bilder einbinden ist kein Thema, oder?Bilder einbinden ist kein Thema, oder?
Bilder einbinden ist kein Thema, oder?
Walter Ebert1.9K views
(Responsive) Video by Walter Ebert
(Responsive) Video(Responsive) Video
(Responsive) Video
Walter Ebert1.4K views
Sinn und Unsinn von SSL by Walter Ebert
Sinn und Unsinn von SSLSinn und Unsinn von SSL
Sinn und Unsinn von SSL
Walter Ebert2.4K views
Responsive Design: Mehr als CSS by Walter Ebert
Responsive Design: Mehr als CSSResponsive Design: Mehr als CSS
Responsive Design: Mehr als CSS
Walter Ebert4.6K views
Die .htaccess richtig nutzen by Walter Ebert
Die .htaccess richtig nutzenDie .htaccess richtig nutzen
Die .htaccess richtig nutzen
Walter Ebert5.3K views
Javascript auf Client und Server mit node.js - webtech 2010 by Dirk Ginader
Javascript auf Client und Server mit node.js - webtech 2010Javascript auf Client und Server mit node.js - webtech 2010
Javascript auf Client und Server mit node.js - webtech 2010
Dirk Ginader20.5K views
Responsive Videos, mehr oder weniger by Walter Ebert
Responsive Videos, mehr oder wenigerResponsive Videos, mehr oder weniger
Responsive Videos, mehr oder weniger
Walter Ebert8.1K views

Similar to Content Security Policy - PHPUGFFM

Session7-XSS & CSRF by
Session7-XSS & CSRFSession7-XSS & CSRF
Session7-XSS & CSRFzakieh alizadeh
296 views32 slides
Web security landscape Unit 3 part 2 by
Web security landscape Unit 3 part 2Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2SURBHI SAROHA
259 views33 slides
Web-Security-Application.pptx by
Web-Security-Application.pptxWeb-Security-Application.pptx
Web-Security-Application.pptxhamidTalib2
6 views30 slides
logout.php Session Data after Logout Username Email . $_.docx by
logout.php Session Data after Logout  Username  Email  . $_.docxlogout.php Session Data after Logout  Username  Email  . $_.docx
logout.php Session Data after Logout Username Email . $_.docxsmile790243
3 views9 slides
Website hacking and prevention (All Tools,Topics & Technique ) by
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Jay Nagar
669 views180 slides
Prevention of Cross-Site Scripting using Hash Technique by
Prevention of Cross-Site Scripting using Hash TechniquePrevention of Cross-Site Scripting using Hash Technique
Prevention of Cross-Site Scripting using Hash TechniqueIJCSIS Research Publications
34 views5 slides

Similar to Content Security Policy - PHPUGFFM(20)

Web security landscape Unit 3 part 2 by SURBHI SAROHA
Web security landscape Unit 3 part 2Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2
SURBHI SAROHA259 views
Web-Security-Application.pptx by hamidTalib2
Web-Security-Application.pptxWeb-Security-Application.pptx
Web-Security-Application.pptx
hamidTalib26 views
logout.php Session Data after Logout Username Email . $_.docx by smile790243
logout.php Session Data after Logout  Username  Email  . $_.docxlogout.php Session Data after Logout  Username  Email  . $_.docx
logout.php Session Data after Logout Username Email . $_.docx
smile7902433 views
Website hacking and prevention (All Tools,Topics & Technique ) by Jay Nagar
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )
Jay Nagar669 views
Cross Site Scripting ( XSS) by Amit Tyagi
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)
Amit Tyagi27.2K views
Browser Security ppt.pptx by AjaySahre
Browser Security ppt.pptxBrowser Security ppt.pptx
Browser Security ppt.pptx
AjaySahre51 views
Web Vulnerabilities And Exploitation - Compromising The Web by Zero Science Lab
Web Vulnerabilities And Exploitation - Compromising The WebWeb Vulnerabilities And Exploitation - Compromising The Web
Web Vulnerabilities And Exploitation - Compromising The Web
Zero Science Lab1.7K views
Report on xss and do s by mehr77
Report on xss and do sReport on xss and do s
Report on xss and do s
mehr77737 views
XSS: From alert(1) to crypto mining malware by Omer Meshar
XSS: From alert(1) to crypto mining malwareXSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malware
Omer Meshar1.4K views
04. xss and encoding by Eoin Keary
04.  xss and encoding04.  xss and encoding
04. xss and encoding
Eoin Keary2K views
Study of Cross-Site Scripting Attacks and Their Countermeasures by Editor IJCATR
Study of Cross-Site Scripting Attacks and Their CountermeasuresStudy of Cross-Site Scripting Attacks and Their Countermeasures
Study of Cross-Site Scripting Attacks and Their Countermeasures
Editor IJCATR431 views
4.Xss by phanleson
4.Xss4.Xss
4.Xss
phanleson1.2K views

More from Walter Ebert

FrOSCon 2023: WordPress als ActivityPub-Instanz by
FrOSCon 2023: WordPress als ActivityPub-InstanzFrOSCon 2023: WordPress als ActivityPub-Instanz
FrOSCon 2023: WordPress als ActivityPub-InstanzWalter Ebert
3 views31 slides
Hero Video Performance - DrupalCamp Ruhr by
Hero Video Performance - DrupalCamp RuhrHero Video Performance - DrupalCamp Ruhr
Hero Video Performance - DrupalCamp RuhrWalter Ebert
14 views25 slides
Sicherheit für WordPress by
Sicherheit für WordPressSicherheit für WordPress
Sicherheit für WordPressWalter Ebert
630 views31 slides
WordPress aufräumen - WordCamp Stuttgart by
WordPress aufräumen - WordCamp StuttgartWordPress aufräumen - WordCamp Stuttgart
WordPress aufräumen - WordCamp StuttgartWalter Ebert
1.5K views32 slides
WordPress aufräumen by
WordPress aufräumenWordPress aufräumen
WordPress aufräumenWalter Ebert
1K views24 slides
Hero Video Performance by
Hero Video PerformanceHero Video Performance
Hero Video PerformanceWalter Ebert
1.2K views25 slides

More from Walter Ebert(20)

FrOSCon 2023: WordPress als ActivityPub-Instanz by Walter Ebert
FrOSCon 2023: WordPress als ActivityPub-InstanzFrOSCon 2023: WordPress als ActivityPub-Instanz
FrOSCon 2023: WordPress als ActivityPub-Instanz
Walter Ebert3 views
Hero Video Performance - DrupalCamp Ruhr by Walter Ebert
Hero Video Performance - DrupalCamp RuhrHero Video Performance - DrupalCamp Ruhr
Hero Video Performance - DrupalCamp Ruhr
Walter Ebert14 views
Sicherheit für WordPress by Walter Ebert
Sicherheit für WordPressSicherheit für WordPress
Sicherheit für WordPress
Walter Ebert630 views
WordPress aufräumen - WordCamp Stuttgart by Walter Ebert
WordPress aufräumen - WordCamp StuttgartWordPress aufräumen - WordCamp Stuttgart
WordPress aufräumen - WordCamp Stuttgart
Walter Ebert1.5K views
Hero Video Performance by Walter Ebert
Hero Video PerformanceHero Video Performance
Hero Video Performance
Walter Ebert1.2K views
WordPress-Webseiten umziehen / online stellen by Walter Ebert
WordPress-Webseiten umziehen / online stellenWordPress-Webseiten umziehen / online stellen
WordPress-Webseiten umziehen / online stellen
Walter Ebert537 views
Using browser settings for performance by Walter Ebert
Using browser settings for performanceUsing browser settings for performance
Using browser settings for performance
Walter Ebert581 views
Das richtige WordPress-Theme finden by Walter Ebert
Das richtige WordPress-Theme findenDas richtige WordPress-Theme finden
Das richtige WordPress-Theme finden
Walter Ebert320 views
WordPress Health Check - WordCamp Würzburg by Walter Ebert
WordPress Health Check - WordCamp WürzburgWordPress Health Check - WordCamp Würzburg
WordPress Health Check - WordCamp Würzburg
Walter Ebert1.8K views
WordPress Health Check by Walter Ebert
WordPress Health CheckWordPress Health Check
WordPress Health Check
Walter Ebert315 views
Making WordPress fast(er) by Walter Ebert
Making WordPress fast(er)Making WordPress fast(er)
Making WordPress fast(er)
Walter Ebert766 views
Testumgebungen für WordPress by Walter Ebert
Testumgebungen für WordPressTestumgebungen für WordPress
Testumgebungen für WordPress
Walter Ebert1.2K views
Modernism in Web Design by Walter Ebert
Modernism in Web DesignModernism in Web Design
Modernism in Web Design
Walter Ebert1.4K views
Weniger aus Bilder holen by Walter Ebert
Weniger aus Bilder holenWeniger aus Bilder holen
Weniger aus Bilder holen
Walter Ebert1.9K views
WordPress mit Composer und Git verwalten by Walter Ebert
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwalten
Walter Ebert1.6K views
High Performance Images by Walter Ebert
High Performance ImagesHigh Performance Images
High Performance Images
Walter Ebert5.9K views
HTTPS + Let's Encrypt by Walter Ebert
HTTPS + Let's EncryptHTTPS + Let's Encrypt
HTTPS + Let's Encrypt
Walter Ebert1.8K views
WordPress-Templates mit Twig erstellen - PHPUGFFM by Walter Ebert
WordPress-Templates mit Twig erstellen - PHPUGFFMWordPress-Templates mit Twig erstellen - PHPUGFFM
WordPress-Templates mit Twig erstellen - PHPUGFFM
Walter Ebert2K views

Recently uploaded

Special_edition_innovator_2023.pdf by
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdfWillDavies22
17 views6 slides
Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
31 views1 slide
virtual reality.pptx by
virtual reality.pptxvirtual reality.pptx
virtual reality.pptxG036GaikwadSnehal
11 views15 slides
Black and White Modern Science Presentation.pptx by
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptxmaryamkhalid2916
16 views21 slides
Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
30 views43 slides

Recently uploaded(20)

Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma31 views
Black and White Modern Science Presentation.pptx by maryamkhalid2916
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptx
maryamkhalid291616 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman30 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software257 views
Lilypad @ Labweek, Istanbul, 2023.pdf by Ally339821
Lilypad @ Labweek, Istanbul, 2023.pdfLilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdf
Ally3398219 views
From chaos to control: Managing migrations and Microsoft 365 with ShareGate! by sammart93
From chaos to control: Managing migrations and Microsoft 365 with ShareGate!From chaos to control: Managing migrations and Microsoft 365 with ShareGate!
From chaos to control: Managing migrations and Microsoft 365 with ShareGate!
sammart939 views
DALI Basics Course 2023 by Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg16 views
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst476 views

Content Security Policy - PHPUGFFM

  • 1. Content Security Policy Walter Ebert http://www.flickr.com/photos/murdelta/5963788863/ PHP Usergroup Frankfurt am Main 21. November 2013
  • 3. XSS Cross-Site-Scripting ist eine Art der HTML Injection. Cross-Site-Scripting tritt dann auf, wenn eine Webanwendung Daten annimmt, die von einem Nutzer stammen, und diese Daten dann an einen Browser weitersendet, ohne den Inhalt zu überprüfen. Damit ist es einem Angreifer möglich, auch Skripte indirekt an den Browser des Opfers zu senden und damit Schadcode auf der Seite des Clients auszuführen. https://de.wikipedia.org/wiki/Cross-Site-Scripting
  • 6. W3C Content Security Policy CSP 1.0 http://www.w3.org/TR/CSP/ CSP 1.1 (In Arbeit) https://dvcs.w3.org/hg/content-security-policy/r aw-file/tip/csp-specification.dev.html
  • 8. Konfiguration Apache <IfModule mod_headers.c> Header set Content-Security-Policy "default-src 'self';" </IfModule> PHP header("Content-Security-Policy: default-src 'self';");
  • 9. $ curl -I http://dev.walterebert.com HTTP/1.1 200 OK Date: Sat, 02 Nov 2013 12:49:57 GMT Server: Apache/2.2.22 X-Powered-By: PHP/5.3.17 Cache-Control: max-age=0 Expires: Sat, 02 Nov 2013 12:49:57 GMT Content-Security-Policy: default-src 'self'; Vary: Accept-Encoding Content-Type: text/html; charset=utf-8
  • 11. Reporting Apache <IfModule mod_headers.c> Header set Content-Security-Policy-Report-Only "default-src 'self'; report-uri /csp-reporter.php;" </IfModule> PHP header("Content-Security-Policy-Report-Only: default-src 'self'; report-uri /csp-reporter.php;");
  • 12. csp-reporter.php <?php header('HTTP/1.1 204 No Content'); $data = file_get_contents('php://input'); if (is_string($data) and json_decode($data)) { syslog(LOG_INFO, $data); }
  • 13. HTTP POST { "csp-report": { "document-uri":"http://dev.walterebert.com/", "referrer":"", "violated-directive":"default-src 'self' ", "original-policy":"default-src 'self'; report-uri /csp-reporter.php;", "blocked-uri":"http://cdn.slidesharecdn.com", "status-code":200 } }
  • 14. Chrome {"csp-report":{"documenturi":"http://dev.walterebert.com/","referrer":"","violated-directive":"default-src 'self' ","original-policy":"default-src 'self' ; report-uri /cspreporter.php;","blocked-uri":"http://cdn.slidesharecdn.com","status-code":200}} {"csp-report":{"documenturi":"http://dev.walterebert.com/","referrer":"","violated-directive":"default-src 'self' ","original-policy":"default-src 'self' ; report-uri /cspreporter.php;","blocked-uri":"data","status-code":200}} {"csp-report":{"documenturi":"http://dev.walterebert.com/","referrer":"","violated-directive":"default-src 'self' ","original-policy":"default-src 'self' ; report-uri /cspreporter.php;","blocked-uri":"","status-code":200}}
  • 15. Firefox {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"https://cdn.slidesharecdn.com/ss_thumbnails/responsive-design-drupal-meetup-frankfurt-130912115128-phpapp01-thumbnail-2.jpg?1379004938","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"https://cdn.slidesharecdn.com/ss_thumbnails/web-performance-optimierung-developer-week-2013-130625082350-phpapp02-thumbnail-2.jpg?1372582510","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"https://cdn.slidesharecdn.com/ss_thumbnails/webperfdays-amsterdam-2013-responsive-video-130519125920-phpapp02-thumbnail-2.jpg?1378556655","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"self","violated-directive":"inline script base restriction","source-file":"http://dev.walterebert.com/","script-sample":"n// Responsive menunif (typeof window.ma...","line-number":14}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"https://cdn.slidesharecdn.com/ss_thumbnails/web-performance-drupal-meetup-frankfurt-2013-130314172209-phpapp01-thumbnail-2.jpg?1363299801","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"http://cdn.slidesharecdn.com/ss_thumbnails/responsive-design-drupal-meetup-frankfurt-130912115128-phpapp01-thumbnail-2.jpg?1379004938","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"http://cdn.slidesharecdn.com/ss_thumbnails/web-performance-optimierung-developer-week-2013-130625082350-phpapp02-thumbnail-2.jpg?1372582510","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"http://cdn.slidesharecdn.com/ss_thumbnails/webperfdays-amsterdam-2013-responsive-video-130519125920-phpapp02-thumbnail-2.jpg?1378556655","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"http://cdn.slidesharecdn.com/ss_thumbnails/web-performance-drupal-meetup-frankfurt-2013-130314172209-phpapp01-thumbnail-2.jpg?1363299801","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blockeduri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAWCAMAAAC7dUHMAAAAMFBMVEUFCAMREg8aGxkhIyA6PDlkZmN1bJ+SjbCSlJGcmrCwsbC5tcvIycze3+Hw7/H9//xelZ5BAAABu0lEQVR4AZ3U7crcQAgF4MmomY/xeO7/butMdlta+ufNYVkl4IMBSeF/E3Pyh/lIEQCCfzJ7vJHCV2ttuH+12OWNhJUGHm6B5FpvJXcPtPu+txVku/2NFGsMDz5Oy54r+xdSrNZWA F8o1b1d/FxKYmEivtDESggvdhoJjRWxPpCfHWMxupn1gGWc3XyaISvZVU+XcXrvIGYUtuZjOJy+Mh4+HXutgF4qxbyI1gtWZy9lUivnpXpJWBb1WUQU3lG41mgNGPEcqCfY7kxKiimCYrTiJrOLGDUJcZruJyS7zV5meBRiv1b4cAJbSvhITCmHNaWpGltSE6hAFAyEVes9IrhlsjDaIw3Q5/LknhBWRUr3UmvtPFKXviUDM3ZlQM5q/Ej3vaVD5X97kpKK9Ukv1lWPJK6akn52ko4DafwlPdftG7 l3yDPBLdFKHAldRHZLveYuBwIf6Vx0oG0KxAda/0g4kkOq5LBIVdpVa3Gpic9HQg4izjLnkA4VZPQeJGGT3Tx/8zkicqpaZJuB7fgj0e97cGwqG3Bbb78F5w7vdHaak8GXEnGv5J4c67XEWBHrNxTvpSdYo613TOYXgZ5KQK6spScAAAAASUVORK5CYII=","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blockeduri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAyCAMAAAAnSAbsAAAAMFBMVEUJb5U3g6NVlrHnkiJ2qb/rp025vLqlxtTvunTJy8nzyJLY4uX44MPu8vL78OP9//xCc7hCAAACiElEQVR4Ae3X4ZKrKBAFYEC0g4dDv//bbjcYNLPJbqqcn3PuVRpKvrQxlZkJ+lv5k2Yowt+RcopRyN+QhBJTFvCuhASlSIrCm5JKppIqKeOmpAkqosqccFNyRnRQ9yQkjoI585akC dOUe5LMViThlqRxNpXzPensRBLvSbNCljsS86XMvCEhKzFvT+5ISXN619SQCBxLpJJHDX0TRo3x0hReJBYABAFYtfkJaoW+S5Ig+clKzsIXSYmylVJgx+blxu2DhByZRU9LcJU8JkF9ZNm2z5KKKISnLIIpKQpoB6h2wE5uAvoxACeUo/DGz5b5VHLKWfjm2SlndaaNvK7Vpq/fU2FMkwwAszy3PEb21vZLue7PDcIpIYYQRT05hJBfpLos67F9P8plebTH8phvlHBKBo39iFalq9R22zaij2WtXh h+Sm7hlGIOEb2llEySLEfr2SU9shra9WWpF0nJiyQpiBV2Nox2qEdC5L6se7W0U9KzpzNTkpCgEiN+Su2xLqunficBMYoJmT8lbdXjyneSKxKD6L+kEbvJLpnbfkh1r1dJJfqbjf+Qel9O1CG159Pd93aVkEIIwi5JCClbkkl17Vlsp3+evFqtv+q1Z69XKSaoSgxjyKSk2BOib/esdnXbjemp/tEf0qPa3T0lAuxnjInjPdmfXe1pfnEbE+/JJyNefPwugIxYl/ombX/UL39/MmIkQd/Fuvg/ibz 2BFC/zfz2hXIrVmyFqnZQNz3jV/RlC8bBoh7gVfL9sLCwWLZxmqGir2z2fww+O/71SZeGXIYE9h39bP6xBWprG3yJNud4FRT4CJTCsye72m/Mi759vLqPPpAFxyu4pEMy49kT//4C+j7/AAp/ttcmKUUDAAAAAElFTkSuQmCC","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blockeduri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAABECAMAAAD6M+gwAAAAwFBMVEXt7PDc29+Wj7LDv9ODfKWMhqyWkLOgm7p6dJ9wa5lnY5S3tsNZV4tMS4RLS4RLS4NMTIStrbnPz9Tx8fLp6eq8vcTCw8ioqrKytLuKjpmIjJeMkJucn6ianaafoqujpq5/hJCBhpKUmKKSlqCRlZ+Pk512fImFipWXm6SUmKF5f4t8go5udYJxeIVzeoZkbXpmb3xocX5rc39vd4Ntd YFgandrdIBbZnNTYG5JWWhOXWtQX21JWmhJWWdKWmj/// +KYSnGAAAGvklEQVR4AazSzW6jMBTF8bDOChPA+QgBB3CKGSZJq6wqnfd/q7k+IGxFnV1/uN1U+uvat5vv37L5xu/wpVtwXpyC6lRFLnLelMSSMebD0Bpcmqe3aEyKVZRlqRXX9nr9EAyGKK1Z8d9RWeoW7ey6MGv3p+tLU5dRk6X9cbEmOx+MqmxS1NRImZSmdOfSgrUQfR+1fYsWSKNRWbLWHg5yDvvgp2a7YrNAGb0qS41dHfNVt+/yBJm6+FxO+tyR0XmRyx9LRjmpmUuRHIutvWWAHCgZEYv CZ3WG2SUalqU6aBouO0HSdBlUa22ZIbcWiawnLZgtAZXKf5DCJXoAllxQU4nM1gWKxjMZugaJ9WTMyu6QHrwcVfSoLA0RJ2Sam3MZqnkrCmkD1ZDG9sSq2EpVgpbZPUs9DYP8eE0CLUkEuoaq6YxtiW1DW5xswNLk9asCapAmdlqQcVCObtCVhEVTa5ybgKU/3uQ/r8TG9WIHO496vNaDxMlAd9jxRZ3GrXb1bCmN4/hJvmgBy2YKxUkrZK6H8tF+uEIPCoU03aBhXMDS8/lF4/g1yihJ6vV9gsQM hxSopkmqvddC9/tsvriCCWsaWHo8gwKLfJSUtznJpFC8/9QhnaaDwqztiati6X6/P+4PGsrV8HzdcqUqJ7OOeztfvz/W0p0OJvWaaFUs/fXuswd/URj19ZL7v/gA4lM+X5UjOKpYS6v70mSQUXrKWbsSZfUf2eTT3CoOBPHlvKel2CG+2FgHV7FPMfvHLmlId/T9v9WOBgGv6k0lMKqIX3dLk1rbTf336aT3USnndQVZf9avnNKJdWajnnU6dVIyhEFWQglWjqK+lcR3TofX8wR+zf/vRjIK/Dsih TAxzmGecLc2M8zzdXrfnsvN6vm8LX/fxtvt8RjH6+Nnq076QtWHg4b+OjIMIldKJ8MI6QaZWB7v0vf9X3c71NL1/Y976bvfnuZyN+okkNgiYe7qYhaQlIAgVFtAS0R5pPSe7FDL9H4v9/L+p7stR70bCcR2QKMARjJPd4iE/ncwCOikXoSfJScz98f7hyE/ +v2evr7hpMqwIpTXjdSFEC1dXxLcFyppDDNioVpzXz/Lmv+UdV2/3YRuJHjvni5DBtnSzXmYgFlIlpfBiEqynmQsyMNMl/c8TqKjUCsPnXygnXjg2JHBSLCvjUQn1ZjLq8jQZTpKAbB5UrCy1FDTvGiKr7hgScwxIy0gXxnWAjkazSpn25IrhfTp0zMdsB+7c7HJwYsutHfeqG774YvdE7VNdftjG3DdXqcC4OtTgrWa7D5PTYn5FWNCXsAIYLEEvlgSUlJ4aFq4mjvGXYeKRnLOph0HkQmxRBZFG EaJjAJIjzBrHakrUGwLY5Fu3D3p7kmVaK5jH2M2UpcLYUwSUVRlmEMgy8UMs8RX3aIXaWfrUZ10zICyelrwsiEoQB+lzHwJKJfysXm6g8W28FVKqULtqrSR9njwKLRnGgpVZkowLCAxlFDduDp9sNBN7TqB4+683GeVmo3ESwEeQz9cYAtKZF/TlSIKe4aaburaBIBK7unaIJ3m2gXUfl+2SXHFfRzoAQ/S9unG2vf6u71clo7yLbBGNwaOSW6eToZW/uED1NMnmoD/NtCG4UE6ZxVNWnH2B2PPcq ZCC/nLFDRz3pz/ibqZRavmhfy/ +bJLUhyGgfCMAxkM+VoNF9L9b7VjKbM/7zysUsFyIn0ltSgXVDnl1Oze+w/IBgsC5MCoXBkbtK76sEWtWHYAePlSWEWSjDCLZUf5RpZ1urQVn+KFARncEfFmklFdIZpoeWUhCfdb6BAwqjh6rQzZXVOcOlmtkCsm3AIpWjA6sTN7J3WuRJHqRXQTQiE49jGuh45x+XYvzDH2i3GIfXz7igK5qBK4SSWG3RRV9bN+zR0zN617X9snJu65DCr6LKsqKBLLNSFCasku+bx95LzlF+ve8rpnSvbMx5yzy hOyg2pCTbIoW6uLpZH78ZH3kdvYcrDlcctPJF9zG7eSsED08ODUKWr+rWiP+rl6ePkrl11Uyy4FY3nX0sHhv8bbJGgOCve7LV/b81hdzVdO8mPbVjo65nzkzmndzD+K94CLWPaZWtxXHtqyhO9vA5f78ciB1SoYWTY+FSekKL67dWVqeZnhTGY+HeDg6JlScqMAu/ppUtURDgI5lqtxAeRxxWPnPiZVhI/x2MYBUsv9u5Um1dalVZRQ4J6BK7CgyyBqWxSLhhCyfkjEusPh5ViWO7xzl19Qucj9eL knTbhJJV1ZV/QTofOBKqvq6F1xLfhzKvy3J93bzvF32S+y3QFX1EqmJQAAAABJRU5ErkJggg==","violated-directive":"default-src http://dev.walterebert.com:80"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"self","violated-directive":"inline script base restriction","source-file":"http://dev.walterebert.com/","script-sample":"ntif (typeof window.matchMedia === "unde...","line-number":266}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"self","violated-directive":"inline script base restriction","source-file":"http://dev.walterebert.com/","script-sample":"n/* Modernizr 2.6.2 (Custom Build) | MIT...","line-number":274}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/img/logo2.svg","referrer":"http://dev.walterebert.com/","blocked-uri":"self","violated-directive":"inline style base restriction","source-file":"http://dev.walterebert.com/img/logo2.svg","script-sample":"fill:#007a00;stroke:none;"}} {"csp-report":{"document-uri":"http://dev.walterebert.com/","referrer":"","blocked-uri":"self","violated-directive":"inline script base restriction","source-file":"http://dev.walterebert.com/","script-sample":"try { for(var lastpass_iter=0; lastpass..."}}
  • 16. Direktiven default-src : Alle Ressourcen img-src : Bilder style-src : Stylesheets media-src : Audio + Video frame-src : iframes connect-src : AJAX, WebSockets, EventSource font-src : Schriften object-src : Flash, Java, usw.
  • 17. Keywords * : Alles erlauben 'none' : Nichts erlauben 'self ' : Nur Ursprungsdomain (nicht Subdomains) 'unsafe-inline' : Inline JavaScript + CSS 'unsafe-eval ' : JavaScript eval()
  • 18. Beispiele # Lokal + Inline CSS/JS + Data URI default-src 'self'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data:; # Lokal + CDN default-src 'self' *.amazonaws.com; # Lokal + Bilder von Überall default-src 'self'; img-src: *; # Nur SSL default-src https:; # Explizite Freigaben default-src 'none'; style-src 'self'; script-src 'self'; img-src 'self';
  • 19. Browserunterschiede Firefox default-src 'self'; script-src 'unsafe-inline'; Chrome default-src 'self'; script-src 'self' 'unsafe-inline';
  • 20. $ curl -I http://walterebert.com HTTP/1.1 200 OK Date: Mon, 18 Nov 2013 19:38:14 GMT Server: Apache Cache-Control: max-age=0, no-cache Content-Security-Policy: default-src 'self'; img-src data: http: https: *.slidesharecdn.com *.slideshare.net; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; report-uri /cspreporter.php; Vary: Accept-Encoding Content-Type: text/html; charset=utf-8