Commit 5945508
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
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
0 commit comments