Skip to content

Move the anti-bot rules into antibot_rules.json, and stop counting Imperva's loader as a challenge - #145

Merged
liquidsec merged 3 commits into
1.0-connection-profilesfrom
antibot-rules-json
Oct 26, 2026
Merged

liquidsec merged 3 commits into
1.0-connection-profilesfrom
antibot-rules-json

Conversation

@liquidsec

Copy link
Copy Markdown
Contributor

The protection classifier's vendor rules were hard-coded in src/antibot.rs, so fixing a false positive meant a rebuild and a release. They now live in antibot_rules.json, and the code only runs them.

Rules as data

  • antibot_rules.json holds an ordered list of rules: a vendor, an outcome (challenge, blocked, present), an optional on_refusal outcome, and a when condition built from status, header_present, header_contains, cookie_set, cookie_prefix and body_contains, combined with all, any and not. The first match wins, as before. Rules keep their reasoning in an optional why field, since JSON has no comments.
  • The file is compiled in as the default. blasthttp.set_antibot_rules(path) (antibot::set_rules in Rust) replaces the rules for the process at runtime, and set_antibot_rules() restores the built-in ones. A malformed file is refused when it loads.
  • Vendor is now a name rather than an enum, so a rules file can add a product. Python callers already received vendors as strings and are unaffected.
  • Behaviour is unchanged: every existing classifier test passes against the JSON rules.

Imperva
_Incapsula_Resource anywhere in a body counted as a challenge. Imperva appends its loader script (_Incapsula_Resource?SWJIYLWA=…&ns=1&cb=…) to pages it let through, including the origin's own error pages, so ordinary pages were judged needs_browser and sent to a browser that had nothing to solve. A challenge now needs Imperva's incident page (_Incapsula_Resource?CWUDNSAI=), or a reference to the resource that isn't the loader.

@liquidsec
liquidsec merged commit b682d44 into 1.0-connection-profiles Oct 26, 2026
22 checks passed
@liquidsec
liquidsec deleted the antibot-rules-json branch October 26, 2026 19:45
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.

1 participant