All Projects → nico3333fr → Csp Useful

nico3333fr / Csp Useful

Licence: mit
Collection of scripts, thoughts about CSP (Content Security Policy)

Projects that are alternatives of or similar to Csp Useful

Ismessages
This is simple extension for presenting system-wide notifications from top/bottom of device screen.
Stars: ✭ 299 (-15.54%)
Mutual labels:  notifications
Pync
Python wrapper for Mac OS 10.8 Notification Center
Stars: ✭ 327 (-7.63%)
Mutual labels:  notifications
Chronos
📊 📊 📊 Monitors the health and web traffic of servers, microservices, and containers with real-time data monitoring and receive automated notifications over Slack or email.
Stars: ✭ 347 (-1.98%)
Mutual labels:  notifications
Glnotificationbar
GLNotificationBar is a ios10 style notification bar, can be used to handle push notification in active state.
Stars: ✭ 306 (-13.56%)
Mutual labels:  notifications
Wpf.notifications
WPF notifications UI controls (as seen in VS Code)
Stars: ✭ 318 (-10.17%)
Mutual labels:  notifications
Mmm Remote Control
Magic Mirror Module to shutdown or configure your mirror
Stars: ✭ 331 (-6.5%)
Mutual labels:  notifications
Gander
Gander is a simple in-app HTTP inspector for Android OkHttp clients. Gander intercepts and persists all HTTP requests and responses inside your application, and provides a UI for inspecting their content.
Stars: ✭ 285 (-19.49%)
Mutual labels:  notifications
Reactnative Animation Challenges
A series of animation challenges in React Native.
Stars: ✭ 352 (-0.56%)
Mutual labels:  notifications
Apprise
Apprise - Push Notifications that work with just about every platform!
Stars: ✭ 4,307 (+1116.67%)
Mutual labels:  notifications
Vapor Apns
Simple APNS Library for Vapor (Swift)
Stars: ✭ 344 (-2.82%)
Mutual labels:  notifications
Ng Snotify
Angular 2+ Notification Center
Stars: ✭ 304 (-14.12%)
Mutual labels:  notifications
Webpush
webpush, Encryption Utilities for Web Push protocol
Stars: ✭ 308 (-12.99%)
Mutual labels:  notifications
Telepat Api
This is the Telepat API where HTTP calls are made. CRUD operations are not processed here directly. Messages are sent to the Telepat workers where CRUD operations are being taken care of along with client communication (notifications).
Stars: ✭ 335 (-5.37%)
Mutual labels:  notifications
Gitify
GitHub notifications on your menu bar. Available on macOS, Windows & Linux.
Stars: ✭ 3,543 (+900.85%)
Mutual labels:  notifications
Pg Listen
📡 PostgreSQL LISTEN & NOTIFY for node.js that finally works.
Stars: ✭ 348 (-1.69%)
Mutual labels:  notifications
Ftindicator
A light wight UI package contains local notification, progress HUD, toast, with blur effect, elegant API and themes support.
Stars: ✭ 292 (-17.51%)
Mutual labels:  notifications
Laravel Desktop Notifier
💻 Send notifications to your desktop from your Laravel Artisan Commands. An JoliNotif wrapper for Laravel.
Stars: ✭ 333 (-5.93%)
Mutual labels:  notifications
Apns4erl
Apple Push Notification Server for Erlang
Stars: ✭ 352 (-0.56%)
Mutual labels:  notifications
Sysend.js
Send messages between open pages or tabs in same browser
Stars: ✭ 347 (-1.98%)
Mutual labels:  notifications
Onesignal Website Sdk
OneSignal is a push notification service for web and mobile apps. This SDK makes it easy to integrate your website with OneSignal Push Notifications. https://onesignal.com
Stars: ✭ 338 (-4.52%)
Mutual labels:  notifications

CSP useful, a collection of scripts, thoughts about CSP

I'm testing and using CSP (Content Security Policy), and here are some thoughts, resources, scripts and ideas on it.

Scripts

Report-URI folder

In folder "report-uri", you may find examples of CSP parsers you can use for report-uri.

  • csp-parser-basic.php : the most basic one, it sends an e-mail.
  • csp-parser-enhanced.php : avoids some bugs (listed below as CSP WTF), with a LOT of filters
  • csp-parser-with-database.php : put notifications in a database, then you can do whatever you want with all these informations! :)
  • csp-parser-with-database-pdo.php : also puts CSP notifications in a database but uses PDO instead of the mysqli extension.

CSP directives for third-party services

In folder "CSP for third party services", you may find examples of directives you need to use for some services.

CSP Check folder

In folder "csp-check", you may find the source of a proof of concept: this script was a quick and dirty way to reproduce a bug in Firefox, you can see it in action here: https://csp.nicolas-hoffmann.net/

Basically, the page generates an unique id, notifications sent to report-uri are put in database, the page makes an AJAX call to database, and the unique id helps to find CSP errors in database.

This is useful to prove bugs, not only for Firefox. ^^

To reproduce the bug:

  1. Open https://csp.nicolas-hoffmann.net/
  2. The page is going to generate a unique id, ex https://csp.nicolas-hoffmann.net/?id=foo
  3. Wait some seconds. The page doesn't find any notification in the database.
  4. Now inspect the page with Firefox inspector, please highlight some elements.
  5. Close the inspector
  6. Refresh the page with the id you have : https://csp.nicolas-hoffmann.net/?id=foo
  7. It is going to find a lot of CSP errors.

At the beginning, I've made it to prove that some Chrome extensions are sending notifications to report-uri (while they should not), and it helped to find/prove a bug in Firefox Inspector.

Here is the reported bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1195302

It should be is fixed with Firefox 42 https://bugzilla.mozilla.org/show_bug.cgi?id=1185351 :)

CSP WTF???

In folder "CSP WTF", you may find examples of strange notifications you may receive. Feel free to add/explain some.

Now the list is splitted in two, explained or not yet explained notifications.

Small tips and tricks

Multiple domains

Be careful if you have multiple domain names (foo.com, foo.net) pointing to a single website while using 'self' as value. Example: if a user is using a full url for an image, let's say http://foo.com/image.jpg, using 'self' won't be enough if the user is on foo.net. Be sure to allow all necessary domains.

Generate a hash

If you really have to use some inline scripts/css, for example:

<script>alert('Hello, world.');</script>

You might add 'sha256-qznLcsROx4GACP2dm0UCKCzCG-HiZ1guq6ZZDob_Tng=' as valid source in your script-src directives. The hash generated is the result of:


base64_encode(hash('sha256', "alert('Hello, world.');", true))

in PHP for example.

Chrome PDF viewer blocking

According to Philippe De Ryck, setting CSP's object-src to 'none' blocks Chrome's PDF viewer. As he says, "unless you're hosting vulnerable flash files yourself, go with 'self', and ignore the warning on the CSP Evaluator".

Safari

According to, Safari’s default media controls get blocked when applying a Content-Security-Policy, see https://www.ctrl.blog/entry/safari-csp-media-controls (hint, allow img-src).

What CSP is really good for

In development

I use CSP to clean up some bad old contents (with inline-styles for example).

  1. Just activate CSP on a site with a report-uri
  2. Ask your boss/collegues/grandma to browse the website
  3. All notifications will come without doing anything (yes, I’m lazy)
  4. Yay, you know where you have to make some cleanup

Moreother, if you don't have the time to clean it, setting up CSP policy will avoid bad old styles from breaking the nice/clean new design. Or it will tell you when contributors are doing shit on the website.

To migrate a website to HTTPS

You might read how the Guardian moved to HTTPS using CSP: https://www.theguardian.com/info/developer-blog/2016/nov/29/the-guardian-has-moved-to-https

Progressive enhancement and orthogonality

As far as I can see, using CSP on my jQuery plugins helped me a lot to design them without inline styles/js. See for example: https://a11y.nicolas-hoffmann.net/ or https://van11y.net

So it is a great help for progressive enhancement, orthogonality and clean front-end.

How to see easily CSP directives on a website

For Firefox: make Maj+F2 and type "security csp". It will show you directives and advices.

If you have webdevelopper toolbar, go into infos - HTTP headers.

About plugins

JS/jQuery plugins should provide the CSP requirements they need to work (especially inline-styles or inline-js), so:

Bugs I've found

Resources

Resources

CSP with Google

About collecting and filtering reports

Why you should use CSP

Interesting posts on how to deploy CSP

Other

Future of CSP

Online tools that test CSP

Add-ons Navigator

CMS Plugins

Enjoy!

Nicolas Hoffmann - @Nico3333fr

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].