Skip to content

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

0.7.6 - 2026-07-06

Production hardening for the reverse proxy, and full parity with OWASP Coraza on the CRS test corpus.

Added

  • lewaf-proxy --config <file> loads a complete YAML/JSON config — the OWASP CRS (via rule_files), audit logging, storage, and request limits. (--rules-file only handles single-line rules and can't load the CRS.)
  • Structured JSONL audit log — one JSON line per blocked or errored request (timestamp, client IP, method, path, rule id, action), ready to feed a ban scorer or log shipper. Paths never include the query string, so secrets don't leak.
  • @detectSQLi now uses libinjection (a vendored pure-Python port of the engine Coraza uses) instead of a regex approximation — more accurate SQLi detection, still no C extension.
  • Forged X-Forwarded-For gate rule (rules/REQUEST-950-GATE.conf) for deployments behind an nginx that overwrites XFF — blocks requests that arrive already carrying a spoofed XFF header.

Changed

  • The reverse proxy now fails closed: an internal error returns 503 instead of forwarding the request to your app unprotected.
  • Bundled OWASP CRS upgraded to 4.21 (765 rules). LeWAF now agrees with OWASP Coraza on 100% of the CRS regression corpus (98.8% request / 97.9% response conformance against the corpus itself).
  • Closer ModSecurity behavior: @rx matches across newlines (DOTALL), rules fire once per matching value (fixing chained and parameter-pollution detection), and ARGS_NAMES reports duplicate parameter names.

Fixed

  • A malformed or missing rule file now fails loudly at load time instead of silently loading a partial ruleset — so a broken config can't deploy with rules quietly missing. (A glob matching no files stays lenient.)
  • More accurate CRS matching for Unicode/JS-encoded and high-byte payloads.
  • ReDoS protection: every regex match is time-bounded, so a pathological pattern can't hang a request.

Removed

  • The broken lewaf command (it crashed on launch). Use lewaf-proxy and lewaf-validate.

0.7.4 - 2026-06-17

Added

  • Forged X-Forwarded-For gate rule — blocks requests that reach an nginx-fronted deployment already carrying an XFF header (a spoofing attempt).

Changed

  • nginx now overwrites X-Forwarded-For in all docs ($remote_addr, not $proxy_add_x_forwarded_for), so clients can't spoof their IP past IP-based rules and bans.

Fixed

  • Starlette and Flask now use the real client IP from X-Forwarded-For (Django already did), so gate and IP-ban rules see the client instead of the proxy.
  • Reverse proxy works on Starlette 1.x (a lifespan handler replaces the removed on_event).

0.7.3 - 2026-01-07

Added

  • WAF accepts a WAFConfig object directly, and rule files can be loaded by glob (rules/*.conf).
  • Transaction.add_request_headers(), matching add_response_headers().

Changed

  • OWASP CRS loading reached 100% (681 rules, up from 594).
  • Standardized middleware: Flask's FlaskWAFMiddleware → LeWAFMiddleware and SecLangParser → InlineRuleParser (old names still work), and every framework now takes block_status / block_body.

0.7.1 - 2025-12-07

Added

  • Pluggable kernel architecture (KernelProtocol) — a Python reference kernel today, with a path to native (Rust/Zig) acceleration.
  • More SecLang expressiveness: variable counts (&ARGS), key negation (!ARGS:foo), and REST path parameters via @restpath (ARGS_PATH).
  • Engine directives SecRuleEngine, SecRequestBodyAccess, and SecResponseBodyAccess are now recognized.

Changed

  • The redirect and skip actions now work end-to-end, and audit-log actions (auditlog / noauditlog) update transaction state.

Fixed

  • Starlette middleware reads the request body before inspection, the response-header phase now runs, and config-file loading works.

Documentation

  • ADR-001/002 (kernel design and native roadmap) and a README "Known Limitations" note for the drop and exec actions.

0.7.0 - 2025-12-05

First public release — a pure-Python Web Application Firewall implementing the ModSecurity SecLang specification, usable as framework middleware or a standalone reverse proxy.

  • WAF engine: full 5-phase request/response inspection.
  • SecLang rules: ModSecurity-compatible — 32 operators, 45 transformations, 37 actions, ~40 variables, plus chains and macros.
  • OWASP CRS protection: SQL injection, XSS, remote code execution, file inclusion (LFI/RFI), path traversal, and protocol enforcement.
  • Body inspection: JSON, XML, multipart, and URL-encoded, with automatic content-type detection.
  • Persistent state (Memory / File / Redis): rate limiting, brute-force detection, and session anomaly scoring, with TTLs.
  • Compliance-ready audit logs: JSON events with PCI-DSS data masking and GDPR IP anonymization.
  • Framework integrations: FastAPI, Flask, Django, and Starlette.
  • Docs: API reference, per-framework integration guides, and Docker/Kubernetes deployment guides.