Skip to content

Commit

Permalink
Incrementally improve static filtering parser
Browse files Browse the repository at this point in the history
Most notably, the `denyallow=` option now requires
the presence of a valid `domain=` option to not be
rejected.

Using `denyallow=` without narrowing down using the
`domain=` option leads to catastrophic blocking
behvior, hence the requirement for a valid `domain=`
option.
  • Loading branch information
gorhill committed Nov 7, 2020
1 parent 7da92d3 commit efea83a
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 110 deletions.
11 changes: 7 additions & 4 deletions docs/tests/static-filtering-parser-checklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ a*
$script,redirect=noop.js
*$empty
*$xhr,empty
*$redirect=empty
*$xhr,redirect=empty

*$csp=default-src 'none'
Expand All @@ -58,7 +57,7 @@ $script,redirect=noop.js
*$domain=toto.com|toto.*|~toto.com|~toto.*|tôtó.ça|tôtó.*|~tôtó.ça|[ff00::0]|1.1.1.1

! valid denyallow option values
*$denyallow=toto.com|tôtó.ça|[ff00::0]|1.1.1.1
*$denyallow=toto.com|tôtó.ça|[ff00::0]|1.1.1.1,domain=toto.com



Expand Down Expand Up @@ -95,10 +94,11 @@ $
! can't redirect without type (except to `empty`)
*$redirect=noop.js

! can't redirect beacon, ping, websocket
! non-redirectable types
*$beacon,redirect-rule=empty
*$ping,redirect-rule=empty
*$websocket,redirect-rule=empty
*$ghide,redirect=noop.js

! can't mix csp with other types or redirect directives
*$csp=default-src 'none',empty
Expand All @@ -119,4 +119,7 @@ $
*$domain=.toto.com|toto.com.|[ff00::00000]|1.1.1.1111

! invalid denyallow= option values
*$denyallow=.toto.com|toto.com.|toto.*|~toto.com|~toto.*|[ff00::00000]|1.1.1.1111
*$denyallow=.toto.com|toto.com.|toto.*|~toto.com|~toto.*|[ff00::00000]|1.1.1.1111,domain=toto.com

! denyallow= requires a domain= option
*$script,denyallow=toto.com
Loading

0 comments on commit efea83a

Please sign in to comment.