diff --git a/bin/serve.es b/bin/serve.es index 50942461de4..7c93f26dc35 100644 --- a/bin/serve.es +++ b/bin/serve.es @@ -6,7 +6,8 @@ const = require ('../middleware') middleware = [ - route (`/hello/`, Resource `/resource/fixtures/`) + route (`/report/`, Resource `/report/`) +, route (`/hello/`, Resource `/resource/fixtures/`) , route (`/examples/`, Resource `/examples/`) ] diff --git a/index.css b/index.css index 9e0acdec87e..946b80710e5 100644 --- a/index.css +++ b/index.css @@ -1,3 +1,8 @@ +/* + // enough inline styles to paint to fold + // Japanese colors - https://en.wikipedia.org/wiki/Traditional_colors_of_Japan#Red.2FViolet_series +*/ + :root { --margin: 0 0; } @@ -271,4 +276,3 @@ body > main, body > aside { flex: 1 } } @media (min-width:1300px) { } - diff --git a/index.html b/index.html index c0cc2122078..c3fcc8b3b62 100644 --- a/index.html +++ b/index.html @@ -16,6 +16,7 @@ href=/index.css rel='preload stylesheet' > + - - - @@ -937,5 +932,5 @@

Further Learning

Copyright © 2018 A devPunks project - + diff --git a/middleware/README.md b/middleware/README.md index d4f0fd0f4f1..cbdc6043aab 100644 --- a/middleware/README.md +++ b/middleware/README.md @@ -1,6 +1,11 @@ # middleware +## snuggsi.cors + +Cross Origin Resource Sharing + + ## snuggsi.auth Middleware used for Authentication. @@ -8,10 +13,38 @@ Middleware used for Authentication. ## snuggsi.security +Browser security for frames and XSS attacks + + +## snuggsi.policy + Middleware used for CSP (Content Security Policy). + - W3C Web App Security - https://github.com/w3c/webappsec + - W3C CSP3 Specification - https://w3c.github.io/webappsec-csp + - W3C Mixed Content (CR) - https://w3c.github.io/webappsec-mixed-content + - W3C Upgrade Insecure Requests (CR) - https://w3c.github.io/webappsec/specs/upgrade/ + - Wikipedia Documentation - https://en.wikipedia.org/wiki/Content_Security_Policy + - MDN Documentation - https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP + + +### Services + + - Report-Uri - https://report-uri.com + - Reporting for security headers https://securityheaders.io + - Collection of CSP Bypasses - http://sebastian-lekies.de/csp/bypasses.php + + +### Links + + - Helmet - https://helmetjs.github.io + - GOOGLE CSP - https://csp.withgoogle.com/docs/strict-csp.html + - Mozilla Security Guidelines - https://wiki.mozilla.org/Security/Guidelines/Web_Security#Content_Security_Policy - https://medium.com/square-corner-blog/content-security-policy-for-single-page-web-apps-78f2b2cf1757 - https://www.owasp.org/index.php/HTTP_Strict_Transport_Security_Cheat_Sheet + - Node Security Platform - https://nodesecurity.io/resources + - Github's CSP Journey - https://githubengineering.com/githubs-csp-journey + - Github's post-CSP Journey - https://githubengineering.com/githubs-post-csp-journey ## snuggsi.route diff --git a/middleware/index.es b/middleware/index.es index 43a1e692d01..0650e60fd06 100644 --- a/middleware/index.es +++ b/middleware/index.es @@ -6,6 +6,7 @@ module.exports = { auth : require ('./auth') , cors : require ('./cors') , security : require ('./security') +, policy : require ('./policy.es') // because .json ❓❓❓ , browse : require ('./browse') , snuggsi : require ('./snuggsi') , route : require ('./route') diff --git a/middleware/index.test b/middleware/index.test index 07f1f744931..46227a2288f 100644 --- a/middleware/index.test +++ b/middleware/index.test @@ -3,5 +3,9 @@ require ('./cors.test') require ('./security.test') require ('./snuggsi.test') require ('./route.test') +require ('./policy.test') +// require ('./compressor.test') +// require ('./negotiator.test') +//require ('./librarian.test') require ('./assets.test') diff --git a/middleware/policy.es b/middleware/policy.es new file mode 100644 index 00000000000..8e13db8c7c5 --- /dev/null +++ b/middleware/policy.es @@ -0,0 +1,107 @@ +// Can actually charge for this feature // https://report-uri.com/#prices + +const +//schemes = ['safari-extension://', 'chrome-extension://', 'https://', 'http://'] + header = 'Content-Security-Policy' +, SECURE = true +// Depending on analytics framework, +// may want to listen for securitypolicyviolation events +// with JavaScript and collect more information about the client before reporting. +, report = ['https://snuggsi.report-uri.com/r/d/csp/enforce'] // report-to // *DEPRECATED* report-uri + +, defaults = ["'self'"] // default-src +, img = defaults // img-src +, style = defaults // style-src + // nonce-${nonce} ** MUST BE UNIQUE ** + // https://w3c.github.io/webappsec-csp/#framework-directive-source-list + // **NEVER EXPOSE!!! Causes XSS attacks** script-src 'unsafe-inline' + // **THAT BEING SAID...For Safari 😢 + // 'unsafe-inline' // THIS MAY NOT BE TRUE IN 2018 +, script = defaults // script-src Script Nonce for inline