Coder Social home page Coder Social logo

nico3333fr / csp-useful Goto Github PK

View Code? Open in Web Editor NEW
474.0 474.0 59.0 977 KB

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

License: MIT License

PHP 71.97% CSS 27.23% HTML 0.79%
content-security-policy csp csp-directives csp-parsers csp1 csp2 csp3 notifications report-uri

csp-useful's People

Contributors

aaronjensen avatar amotmot avatar borisschapira avatar braiam avatar csmith avatar d-32 avatar d9ping avatar dbarlett avatar dpeukert avatar dylburger avatar fwebdev avatar gloomy-ghost avatar jordaaash avatar jswart avatar karinon avatar kraftner avatar laradevitt avatar macewindu avatar mattok avatar nhoizey avatar nico3333fr avatar rizkit avatar roycewilliams avatar scotthelme avatar seirdy avatar shaialon avatar shekyan avatar stevendegroote avatar studiomax avatar zero-24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csp-useful's Issues

Remove misconfigured WTFs

Many of the WTFs are just the result of misconfigured CSP directives. For example:

Those are both lacking 'self' for style-src, so their styles are getting blocked.

A good chunk of the script-sample entries fall into this category. Anything with blocked-uri: self should be considered to be a misconfiguration--the developer is simply missing 'self'.

Form-action: data

I'm occasionally getting violation reports from Opera and Chrome saying that someone is setting their form-action to a data URL:

{
"csp-report": {
"document-uri": [SITE URL],
"effective-directive": "form-action",
"original-policy": "default-src [SITE URL]; style-src https: 'unsafe-inline'; img-src data: blob: https:; frame-src *; child-src * blob:; worker-src 'self' blob:; script-src https: 'unsafe-inline' 'report-sample' 'self' 'strict-dynamic' 'nonce-[removed]'; object-src 'none'; form-action [SITE URL]; report-uri [SITE URL]; report-to csproReportEndpoint;",
"blocked-uri": "data"
}
}

Does this make any sense to anyone?

butstrap

it is probably from an extension in your browser, it was a vk downloader one for me

Overwritten array entries in csp-parser-enhanced.php

$tab_filter in csp-parser-enhanced.php contains a couple of entry that will never be triggered in foreach loop:

  • 'chromenull://': 'filter_on' => 'source_file' is overwritten by 'chromenull://' 'filter_on' => 'blocked_uri'
  • 'safari-extension://' 'filter_on' => 'blocked_uri' is overwritten by 'safari-extension://' 'filter_on' => 'source_file'

Blocked URI : properties

A new one, on which i haven't found any details yet : the "properties" blocked URI.
It is linked only with the "connect-src" directive, and applies on legit site URLs (standard pages of the website the CSP apply to).

Explanation: "blocked-uri": "inline" and similar

This happens if you don't allow inline scripts--that is, <script> with no src attribute, but rather embedded JavaScript. Inline JavaScript has to be explicitly allowed via 'inline'.

Note that some analytics tools and other libraries may inject their own inline <script> tags.

blocked domain === domain the site runs on?

{
    "csp-report": {
        "document-uri": "https://www.example.org/...",
        "referrer": "",
        "violated-directive": "img-src 'self'",
        "original-policy": "default-src 'self';",
        "blocked-uri": "https://www.example.org"
    }
}

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b

Where "example.org" is replaced by the live domain.
I guess it is something about Big Preview but I have no idea wtf is happening there. As 'self' is allowed so the domain the rule run on should be allowed.

wrcx source found?

Hey guys. Not sure if you wanted reports as issues (sorry if not!), but I believe I may have found the source of the unknown 'wrcx' report:

https://github.com/vikeshkhanna/pointers/blob/master/youtube_files/iframe.htm

It's a Chrome extension 'to add seek markers / pointers to the YouTube timeline. You can add as many pointers you wish, drag them on the timeline, delete them and seek to that point in the video by clicking the marker. Extension uses content scripts, jquery and jquery-ui. ' - see https://github.com/vikeshkhanna/pointers

How to make HTML5 <video> compatible with CSP (Google Chrome)?

Hello there,

I use HTML5 video element on my website and a strict Content-Security-Policy directive (default-src 'self'). I get this error message in Google Chrome console when I load for the first time a page with video element:

[Report Only] Refused to load the image '' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

[Report Only] Refused to load the image 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOTYgMTk2IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxOTYgMTk2OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik05OCw0OXY0Yy0yNC45LDAtNDUsMjAuMS00NSw0NQoJYzAsMTgsMTAuNiwzMy42LDI1LjksNDAuOGwtMS43LDMuNmMwLjEsMCwwLjIsMC4xLDAuMywwLjFjLTAuMSwwLTAuMi0wLjEtMC4zLTAuMWwwLDBDNjAuNSwxMzQuNSw0OSwxMTcuNiw0OSw5OAoJQzQ5LDcwLjksNzAuOSw0OSw5OCw0OXoiLz4KPC9zdmc+Cg==' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

There is a total of 9 data:image violating CSP directive. These data:image are used for the controls of video element. If they are blocked it is impossible to use the video element.

I am aware of the possibility to use "img-src 'self' data:;" directive, but I would like to avoid this solution as it reduce the protection I could get from strict CSP directives.

I notice that HTML5 video element does not violate CSP directive when I use Edge or Firefox.

Is it possible to fix this issue ? Thank you.

Explained: extension schemes

chrome-extension: will appear in reports when a Chrome extension attempts to inject a script, iframe, or other content into a page that doesn't explicitly allow the chrome-extension: scheme. If users are complaining that their extensions aren't working on your site, this is why. Oftentimes they're injecting questionable content (e.g., ads or analytics), in which case you may want to deliberately omit this.

moz-extension is the same thing, but for Firefox.

Depending on how the extension works and what browser is being used, about:blank or other about: URLs may appear instead of an extension scheme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.