Skip to content

initial version of a command line invocation #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pes10k
Copy link
Collaborator

@pes10k pes10k commented Apr 29, 2025


usage: check.js [-h] [-v] --url URL --context-url CONTEXT_URL --rule-files
                [RULE_FILES ...] [--verbose]
                (--type {beacon,csp_report,document,font,image,media,object,ping,script,stylesheet,sub_frame,websocket,xhr,other,speculative,web_manifest,xbl,xml_dtd,xslt} | --chromium-type {Attribution resource,Audio,CSS resource,CSS stylesheet,Dictionary,Document,Fetch,Font,Icon,Image,Internal resource,Link element resource,Link prefetch resource,Manifest,Mock,Other resource,Processing instruction,Script,SpeculationRule,SVG document,SVG Use element resource,Text track,Track,User Agent CSS resource,Video,XML resource,XMLHttpRequest,XSL stylesheet})

Check whether a URL would be blocked by given filter list rules

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  --url URL             The full URL to check against the provided filter
                        lists. (default: undefined)
  --context-url CONTEXT_URL
                        The security context the request occurred in, as a
                        full URL (default: undefined)
  --rule-files [RULE_FILES ...]
                        One or more paths to files of filter list rules to
                        check the request against (default: undefined)
  --verbose             Print information about what rule(s) the request
                        matched. (default: false)
  --type {beacon,csp_report,document,font,image,media,object,ping,script,stylesheet,sub_frame,websocket,xhr,other,speculative,web_manifest,xbl,xml_dtd,xslt}
                        The type of the request, using the types defined by
                        filter list projects (default: undefined)
  --chromium-type {Attribution resource,Audio,CSS resource,CSS stylesheet,Dictionary,Document,Fetch,Font,Icon,Image,Internal resource,Link element resource,Link prefetch resource,Manifest,Mock,Other resource,Processing instruction,Script,SpeculationRule,SVG document,SVG Use element resource,Text track,Track,User Agent CSS resource,Video,XML resource,XMLHttpRequest,XSL stylesheet}
                        The type of the request, using the types defined by
                        chromium (default: undefined)

Copy link

The security team is monitoring all repositories for certain keywords. This PR includes the word(s) "csp" and so security team members have been added as reviewers to take a look.

No need to request a full security review at this stage, the security team will take a look shortly and either clear the label or request more information/changes.

Notifications have already been sent, but if this is blocking your merge feel free to reach out directly to the security team on Slack so that we can expedite this check.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: 6808ba0 Previous: d56be21 Ratio
rule-match-browserlike/brave-list 1745283947 ns/iter (± 20249004) 1727033355 ns/iter (± 11920489) 1.01
rule-match-first-request/brave-list 1006105 ns/iter (± 19039) 1005963 ns/iter (± 12764) 1.00
blocker_new/brave-list 228886810 ns/iter (± 7299621) 220140757 ns/iter (± 5159081) 1.04
memory-usage/brave-list-initial 41408849 ns/iter (± 3) 41408849 ns/iter (± 3) 1
memory-usage/brave-list-after-1000-requests 44004875 ns/iter (± 3) 44004875 ns/iter (± 3) 1

This comment was automatically generated by workflow using github-action-benchmark.

@pes10k
Copy link
Collaborator Author

pes10k commented Apr 29, 2025

You can invoke like this:

npm run check -- \
  --url <REQUEST URL> \
  --type <REQUEST TYPE> \
  --context-url <SECURITY CONTEXT URL> \
  --rule-files <PATH> <PATH> ...;

@pes10k pes10k force-pushed the add-command-line-option branch from 29f016e to fb9d1fb Compare April 29, 2025 23:44
@pes10k
Copy link
Collaborator Author

pes10k commented Apr 29, 2025

The security team is monitoring all repositories for certain keywords. This PR includes the word(s) "csp" and so security team members have been added as reviewers to take a look. No need to request a full security review at this stage, the security team will take a look shortly and either clear the label or request more information/changes. Notifications have already been sent, but if this is blocking your merge feel free to reach out directly to the security team on Slack so that we can expedite this check.

FWIW, the "csp" reference added here is just because its a request type that filter list rules can target (or exclude)

@pes10k pes10k force-pushed the add-command-line-option branch from fb9d1fb to 0c30f8c Compare April 29, 2025 23:58
@pes10k pes10k force-pushed the add-command-line-option branch from 0c30f8c to 6808ba0 Compare April 30, 2025 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants