GithubHelp home page GithubHelp logo

sri-checker's Introduction

sri-checker's People

Contributors

stotov avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

sri-checker's Issues

Add a link to internet.nl's repo

@StotoV you've said you've found internet.nl's repository.

Could we add the repo link here for posterity? We could also add it (and a link to Mozilla Observatory) under a section in the README.md;, e.g.: Related Projects.

Thank you.

SRICollector erroring out

How to reproduce:
mkdir -p ./output
echo 'https://www.huizen.nl/' >> ./output/targetList.txt
npm start -- list -i './output/targetlist.txt' -o './output'

We get the following error:

2022-01-20T10:11:18.145Z [verbose]: [Scraper][0] getting SRITag data failed

Where interacting with the CDP session fails the collection

Remove the hardcoded Chromium path

I agree with the comment here that we should possibly comment out this line:

executablePath: '/usr/bin/chromium' // To be removed if at all possible

On my system, the crawler works only if I comment out the line, because there's no chromium instance on /usr/bin/chromium (it's under one of the snap folders). Thus, I get the following:

2022-01-20T11:37:13.534Z [error]: [Scraper][0] https://www.huizen.nl/ Error: Failed to launch the browser process! spawn /usr/bin/chromium ENOENT

I comment the line, and everything works well.

I believe puppeteer node package already installs a Chromium instance that it then uses under the hood.

Add improved logging to CLI

Some progress bars would be nice for longer runs. This code should not clutter the module itself however, as it can also be used as non-cli application.

Add tests for dynamically injected script tags

Scripts may dynamically inject iframes, which may contain script tags that may fail the SRI check. The main advantage of using a JS-enabled browser such as Puppeteer (over e.g., a requests-based solution) is the ability to validate such dynamically added iframes/script tags.

Let's make sure to add a test case to demonstrate this difference.

We'd just need to inject an iframe containing some third-party script tags.
https://stackoverflow.com/a/3069972

We may have tests for the following; (just to give ideas, not concrete suggestions):
should_fail_for_dynamically_added_scripts_without_sri_attrs
should_fail_for_dynamically_added_scripts_with_invalid_sri_attrs
should_pass_for_dynamically_added_scripts_with_valid_sri_attrs

ReferenceError: btoa is not defined

Received a ReferenceError for btoa. Maybe it's because of my node version:

var filename = btoa(target)

Perhaps we can change it with: let filename = Buffer.from(target).toString('base64');

We could also consider including the hostname of the target so the files are more human readable, but that's an optional feature.
Here's how Tracker Radar Collector name files:

Fix end to end test

By locally hosting the test scripts so they do not depend on the state of W3C or the internet connection.

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.