naxsi

BasicRule

BasicRule(s) are present at the location’s configuration level. It is (most of the time) used to create whitelists. BasicRule syntax is :

BasicRule wl:ID [mz:[$URL:target_url]|[match_zone]|[$ARGS_VAR:varname]|[$BODY_VAR:varname]|[$HEADERS_VAR:varname]|[NAME]]

wl:ID (WhiteList)

Which rule ID(s) are whitelisted. Possible syntax are:

mz: (MatchZones)

Specify the zones (see below) in which the exception is allowed. Existing Zones are the following :

Whitelist Example

Totally disable rule #1000 for this location, matchzone is empty, so the whitelist always matches.

BasicRule wl:1000; 

Disable rule #1000 on all url in GET argument named foo:

BasicRule wl:1000 "mz:$ARGS_VAR:foo";

Disable rule #1000 in GET argument named foo for url /bar:

BasicRule wl:1000 "mz:$ARGS_VAR:foo|$URL:/bar";

Disable rule #1000 in all GET arguments for url /bar:

BasicRule wl:1000 "mz:$URL:/bar|ARGS";

Disable rule #1000 in all GET argument NAMES (only name, not content):

BasicRule wl:1000 "mz:ARGS|NAME";

Notes

$URL_X:/foo|$ARGS_VAR:bar : WRONG
$URL_X:^/foo$|$ARGS_VAR_X:^bar$ : GOOD

Regex Whitelist Examples

Available only in naxsi 0.52 and later.

Disable rule #1000 in all GET arguments containing meh:

BasicRule wl:1000 "mz:$ARGS_VAR_X:meh";

Disable rule #1000 in GET argument named meh:

BasicRule wl:1000 "mz:$ARGS_VAR_X:^meh";

Disable rule #1000 in all GET arguments matching meh_<number>:

BasicRule wl:1000 "mz:$ARGS_VAR_X:^meh_[0-9]+$"