How jinayshah-888/csf works
CSF is an inline reverse-proxy firewall: HTTP requests are admitted and authenticated, extracted into inspectable values, evaluated by a cost-ordered detection cascade, adjudicated, then allowed through or blocked. A companion console API and React dashboard expose status, traffic, alerts, attack/JWT labs, and benchmarks. Edges reflect the README, excerpts, and SOURCE INDEX references; several runtime details are unsampled, so uncertain relationships are omitted.
Main entry points: gateway.py Inline gateway · App.jsx Dashboard app · ui.jsx Shared UI components · detector.py Semantic detector
Components 34
Gateway & admission
- Inline gateway
backend/csf/gateway.py - HTTP framing
backend/csf/framing.py - JWT verification
backend/csf/jwtverify.py - JWKS rotation
backend/csf/jwks.py - Rate limits & breaker
backend/csf/resilience.py - Request extraction
backend/csf/extraction.py - Value normalization
backend/csf/normalization.py
Detection cascade
- CRS rules
backend/csf/s1_rules.py - Coraza sidecar
s1-sidecar/main.go - Semantic detector
backend/csf/semantic/detector.py - SQL analysis
backend/csf/semantic/sql.py - Shell analysis
backend/csf/semantic/shell.py - Traversal analysis
backend/csf/semantic/traversal.py - XSS analysis
backend/csf/semantic/xss.py - Model features
backend/csf/model/features.py - Learned detector
backend/csf/model/detector.py
Policy & observability
- Decision engine
backend/csf/decision.py - Verdict types
backend/csf/verdict.py - Runtime configuration
backend/csf/config.py - Config integrity
backend/csf/config_integrity.py - Telemetry & metrics
backend/csf/telemetry.py
Console API
- Console API
console-api/server.py
Dashboard
- Dashboard app
frontend/src/App.jsx - Dashboard API client
frontend/src/api.js - Status dashboard
frontend/src/pages/Dashboard.jsx - Attack lab
frontend/src/pages/AttackLab.jsx - JWT lab
frontend/src/pages/JwtLab.jsx - Traffic view
frontend/src/pages/Traffic.jsx - Benchmarks view
frontend/src/pages/Benchmarks.jsx - Scenarios view
frontend/src/pages/Scenarios.jsx - Shared UI components
frontend/src/components/ui.jsx
Other components
- HTTP client
- Protected upstream
- Operator
Connections 40
- HTTP client → Inline gateway: sends requests
README.md - Inline gateway → HTTP framing: checks framing
backend/csf/gateway.py - Inline gateway → JWT verification: verifies tokens
backend/csf/gateway.py - Inline gateway → Rate limits & breaker: applies limits
backend/csf/gateway.py - Inline gateway → Request extraction: extracts values
backend/csf/gateway.py - Request extraction → Value normalization: normalizes values
backend/csf/extraction.py - Inline gateway → CRS rules: runs stage
backend/csf/main.py - CRS rules → Coraza sidecar: queries rules
README.md - Inline gateway → Semantic detector: runs stage
backend/csf/main.py - Semantic detector → SQL analysis: analyzes SQL
backend/csf/semantic/detector.py - Semantic detector → Shell analysis: analyzes shell
backend/csf/semantic/detector.py - Semantic detector → Traversal analysis: analyzes paths
backend/csf/semantic/detector.py - Semantic detector → XSS analysis: analyzes XSS
backend/csf/semantic/detector.py - Inline gateway → Learned detector: runs stage
backend/csf/main.py - Learned detector → Model features: builds features
backend/csf/model/detector.py - Model features → Request extraction: reads candidates
backend/csf/model/features.py - Inline gateway → Decision engine: submits evidence
backend/csf/gateway.py - Decision engine → Verdict types: uses verdict types
backend/csf/decision.py - Inline gateway → Protected upstream: forwards allowed traffic
README.md - Inline gateway → Telemetry & metrics: records activity
backend/csf/gateway.py - Operator → Console API: inspects gateway
console-api/server.py - Runtime configuration → HTTP framing: configures
backend/csf/config.py - Runtime configuration → Rate limits & breaker: configures
backend/csf/config.py - Config integrity → Runtime configuration: checks integrity
README.md - Console API → Inline gateway: builds gateway
console-api/server.py - Dashboard app → Status dashboard: renders page
frontend/src/App.jsx - Dashboard app → Attack lab: renders page
frontend/src/App.jsx - Dashboard app → JWT lab: renders page
frontend/src/App.jsx - Dashboard app → Traffic view: renders page
frontend/src/App.jsx - Dashboard app → Benchmarks view: renders page
frontend/src/App.jsx - Dashboard app → Dashboard API client: calls
frontend/src/App.jsx - Dashboard API client → Console API: requests console data
README.md - Attack lab → Scenarios view: uses scenarios
frontend/src/pages/AttackLab.jsx - Status dashboard → Shared UI components: renders with
frontend/src/pages/Dashboard.jsx - Attack lab → Shared UI components: renders with
frontend/src/pages/AttackLab.jsx - JWT lab → Shared UI components: renders with
frontend/src/pages/JwtLab.jsx - Traffic view → Shared UI components: renders with
frontend/src/pages/Traffic.jsx - Benchmarks view → Shared UI components: renders with
frontend/src/pages/Benchmarks.jsx - Scenarios view → Shared UI components: renders with
frontend/src/pages/Scenarios.jsx - JWT verification → JWKS rotation: uses key rotation
README.md