How corazawaf/coraza works
Coraza is a Go web application firewall that accepts SecLang rules and inspects HTTP transactions, returning interruptions and audit information. The main workflow is application or HTTP-server input → WAF configuration and rule parsing → transaction processing across request and response phases → enforcement and logging. The graph also preserves the documented plugin extension surface and the internal rule, body-processing, and audit subsystems. Some runtime links are omitted because the sampled excerpts do not show their callers.
Main entry points: corazawaf/transaction.go Transaction processing · types/transaction.go Transaction API · rule_parser.go Rule parser · interceptor.go HTTP adapter
Components 19
Integration
- HTTP adapter
http/interceptor.go - HTTP middleware
http/middleware.go
Configuration
- WAF API
waf.go - WAF configuration
config.go - SecLang parser
internal/seclang/parser.go - Rule parser
internal/seclang/rule_parser.go
Transaction runtime
- Transaction processing
internal/corazawaf/transaction.go - Transaction API
types/transaction.go - Rule variables
internal/variables/variables.go - Variable collections
internal/collections/map.go - Audit logging
internal/auditlog/auditlog.go
Inspection engine
- Rule evaluation
internal/corazawaf/rule.go - Body processors
internal/bodyprocessors/bodyprocessors.go - Rule operators
internal/operators/operators.go - Rule actions
internal/actions/actions.go - Transformations
internal/transformations/transformations.go
Extensions
- Plugin interfaces
experimental/plugins/plugintypes/transaction.go - Plugin registration
experimental/plugins/actions.go
Other components
- Application
Connections 17
- Application → WAF API: configures WAF
- Application → HTTP adapter: serves requests
- Application → HTTP middleware: integrates WAF
- HTTP adapter → Transaction API: feeds HTTP data
http/interceptor.go - HTTP middleware → Transaction API: uses transactions
http/middleware.go - WAF API → WAF configuration: builds configuration
- WAF configuration → SecLang parser: parses directives
- Rule parser → Rule operators: resolves operators
internal/seclang/rule_parser.go - Rule parser → Rule actions: resolves actions
internal/seclang/rule_parser.go - SecLang parser → Rule evaluation: creates rules
- Transaction API → Transaction processing: exposes phases
- Transaction processing → Body processors: processes bodies
internal/corazawaf/transaction.go - Transaction processing → Audit logging: collects audit data
internal/corazawaf/transaction.go - Transaction processing → Rule variables: uses variables
- Rule variables → Variable collections: stores values
- Rule evaluation → Plugin interfaces: uses plugin types
internal/corazawaf/rule.go - Plugin registration → Plugin interfaces: implements interfaces