Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Experimental embeddable firewall for WebExtension

License

Notifications You must be signed in to change notification settings

NanoAdblockerLab/NanoEmbeddable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libmicro Dependencies

Embeddable firewall for WebExtension

Please open an issue if there is something you want me to know.

Writing libmicro filters

URL Matching

|   Anchor beginning or ending if it is the first or last character
||  Anchor domain if it is the first characters
^   Match ending or one of / : ? = &
*   Match zero or more characters
$   Separate matcher from options if it is the last occurrence of this character

Start and end the matcher with / to make it a JavaScript regular expression matcher
Otherwise, other characters except those special characters above will be treated literally

Options

~<option>           Negate the next option


libmicro            Limit to libmicro only, this filter should be ignored by other firewalls
important           Does nothing for now, libmicro does not yet accept white lists
Note: These two options cannot be negated
Note: Filters for libmicro should be generated by a transpiler
Note: The behavior and filter syntax of libmicro may change without warning

first-party         Limit to first party requests only
third-party         Limit to third party requests only
domain=<domains>    Limit to supplied domains only, domains can be individually negated
Note: Up to one of these three options can be in one filter

redirect=<asset>    Redirect the request to an asset instead
replace=<replacer>  Process and change the request with replacers, Quantum only [NOT IMPLEMENTED]
inject=<asset>      Inject JavaScript to page
csp=<extra_rules>   Add extra Content Security Policy rules to page [NOT IMPLEMENTED]
Note: Up to one of these four options can be in one filter


main_frame          Limit to main frames
document            Alias of main_frame

sub_frame           Limit to iframes
subdocument         Alias of sub_frame
iframe              Alias of sub_frame

stylesheet          Limit to style sheets
css                 Alias of stylesheet

script              Limit to JavaScripts
js                  Alias of script

image               Limit to images
img                 Alias of image

font                Limit to fonts

object              Limit to Flash objects
object-subrequest   Alias of object

xmlhttprequest      Limit to XMLHttpRequests
xhr                 Alias of xmlhttprequest

ping                Limit to pings

csp_report          Limit to Content Security Policy violation reports
csp-report          Alias of csp_report
cspreport           Alias of csp_report

media               Limit to medias

websocket           Limit to WebSockets
socket              Alias of websocket

other               Limit to other types
beacon              Alias of other

Matching Logic

libmicro will check if match list matched and negated match list matched
If there is nothing in match list, defaults to matched
If there is nothing in negated match list, defaults to not matched
The final result is matched if and only if match list matched and negate match list is not matched

About

Experimental embeddable firewall for WebExtension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published