Skip to content

Commit 5945508

Browse files
ammarioclaude
andcommitted
feat: add script-based rule evaluation with -s/--script flag
Adds support for custom request evaluation via external scripts as an alternative to regex rules. Features: - New -s/--script flag accepts a program path or inline command - Scripts receive request data via environment variables (HTTPJAIL_URL, HTTPJAIL_METHOD, HTTPJAIL_HOST, HTTPJAIL_SCHEME, HTTPJAIL_PATH) - Exit code 0 allows requests, non-zero blocks them - Script stdout becomes additional context in 403 responses - Inline scripts with spaces are executed via default shell Architecture: - Refactored rules system into trait-based architecture in src/rules/ - PatternRuleEngine for existing regex rules (src/rules/pattern.rs) - ScriptRuleEngine for new script evaluation (src/rules/script.rs) - Unified logging via LoggingRuleEngine wrapper - Enhanced 403 responses to include evaluation context Breaking changes: - Removed unimplemented --interactive flag - -r/--rule and -s/--script options are mutually exclusive 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 013c1f7 commit 5945508

10 files changed

Lines changed: 1014 additions & 104 deletions

File tree

Cargo.lock

Lines changed: 275 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ tls-parser = "0.12.2"
4141
camino = "1.1.11"
4242
filetime = "0.2"
4343
ctrlc = "3.4"
44+
url = "2.5"
4445

4546
[target.'cfg(target_os = "macos")'.dependencies]
4647
nix = { version = "0.27", features = ["user"] }

0 commit comments

Comments
 (0)