Skip to content

Add defence profiles, attack signatures, and documentation#30

Merged
mclueppers merged 2 commits intomainfrom
feat/re-factor-defense-mechanisms
Dec 24, 2025
Merged

Add defence profiles, attack signatures, and documentation#30
mclueppers merged 2 commits intomainfrom
feat/re-factor-defense-mechanisms

Conversation

@mclueppers
Copy link
Contributor

No description provided.

…tion

Defense Profile System:
- DAG-based defense profile execution with defense, operator, action nodes
- New "observation" node type for non-blocking side effects (field_learner)
- Multi-profile execution with aggregation strategies (OR, AND, MAJORITY)
- Score aggregation options (SUM, MAX, WEIGHTED_AVG)
- Built-in profiles: Legacy, Balanced, Strict, Monitor-Only, High-Value
- Visual DAG editor with React Flow

Defense Mechanisms:
- content_hash: Full 64-char SHA256, field-specific hashing, ignore_fields
- field_anomalies: All 5 checks (caps, test-patterns, sequential, no-spaces)
- expected_fields: Combined field set, all 4 actions (block/filter/flag/ignore)
- keyword_filter: ignore_fields, context exclusions, global inheritance
- field_learner: Observation node for automatic field learning

Attack Signatures:
- Pattern-based attack detection with regex/exact/contains matching
- Request part targeting (uri, headers, body, args, cookies)
- Built-in signatures for SQL injection, XSS, path traversal, etc.
- Signature stats tracking and expiration management
- Import/export functionality

Header Standardization:
- Aligned all WAF headers to use X-WAF- prefix consistently
- Updated: X-WAF-Form-Hash, X-WAF-Spam-Score, X-WAF-Spam-Flags,
  X-WAF-Client-IP, X-WAF-Submission-Fingerprint, X-WAF-Fingerprint-Profile
- Added missing proxy headers for HAProxy thresholds
- Fixed empty header output when variables not set

Bug Fixes:
- Fixed vhost-specific endpoint config sync (configs weren't cached)
- Removed broken deregister_instance (socket API disabled in exit_worker)
- Fixed monitoring mode to continue execution and collect all metrics
…tem features

New documentation files:
- DEFENSE_PROFILES.md: Complete guide to the DAG-based defense profile
  system including node types (start, defense, operator, observation, action),
  built-in profiles, multi-profile execution, and aggregation strategies
- ATTACK_SIGNATURES.md: Documentation for attack signatures system with
  pattern matching types, built-in signatures, defense lines integration
- API_HANDLERS.md: Admin API modular handlers documentation
- BEHAVIORAL_TRACKING.md: Anomaly detection and behavioral analysis
- CLUSTER_COORDINATION.md: Leader election and instance management
- FINGERPRINT_PROFILES.md: Client fingerprinting system
- METRICS_AGGREGATION.md: Cluster-wide metrics collection
- guide/USER_GUIDE.md: Complete user guide
- guide/CONFIGURATION_REFERENCE.md: All configuration options
- guide/ATTACK_PLAYBOOK.md: Defense strategies for common attacks

Updated documentation:
- ARCHITECTURE.md: Added defense profile execution layer diagram, updated
  Lua module architecture, HAProxy integration details, cross-component
  communication, standardized X-WAF-* header prefix, added comprehensive
  Related Documentation section
- ENDPOINT_CONFIGURATION.md: Added defense_profiles and defense_lines
  configuration sections with examples and aggregation strategies
- README.md: Updated overview and features
@mclueppers mclueppers requested a review from Copilot December 24, 2025 14:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a comprehensive defense system to the Forms WAF by introducing defense profiles, attack signatures, and extensive documentation to support advanced threat protection and configuration.

Key Changes:

  • Added defense profiles system with DAG-based execution flow for orchestrating multiple defense mechanisms
  • Added attack signatures store with built-in signatures for common attack vectors (WordPress, API abuse, credential stuffing)
  • Added extensive user-facing documentation including user guide, configuration reference, and attack playbook
  • Updated endpoint configuration to support defense profile and fingerprint profile attachments

Reviewed changes

Copilot reviewed 56 out of 71 changed files in this pull request and generated no comments.

Show a summary per file
File Description
openresty/lua/attack_signatures_store.lua New Redis-backed storage layer for managing attack signatures with CRUD operations
openresty/lua/attack_signatures_builtins.lua Built-in attack signature definitions for WordPress, contact forms, APIs, and credential stuffing
openresty/lua/api_handlers/defense_profiles.lua API handlers for defense profile management including validation and simulation
openresty/lua/api_handlers/attack_signatures.lua API handlers for attack signature management with import/export support
openresty/lua/config_resolver.lua Added defense_profiles and fingerprint_profiles passthrough in endpoint resolution
docs/guide/USER_GUIDE.md Comprehensive 1510-line user guide covering setup, configuration, and troubleshooting
docs/guide/CONFIGURATION_REFERENCE.md Complete configuration reference with all available options and Redis key documentation
docs/guide/ATTACK_PLAYBOOK.md Incident response playbook with detection signs and mitigation strategies
docs/DEFENSE_PROFILES.md Technical documentation for the defense profiles DAG system
docs/FINGERPRINT_PROFILES.md Documentation for fingerprint-based client identification
openresty/conf/nginx.conf Updated proxy headers to use X-WAF- prefix consistently
admin-ui/src/pages/endpoints/EndpointForm.tsx Added defense profiles and defense lines tabs to endpoint editor
admin-ui/src/hooks/usePermissions.ts Added permissions for fingerprint profiles, defense profiles, and attack signatures
Files not reviewed (1)
  • admin-ui/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mclueppers mclueppers merged commit b481ab0 into main Dec 24, 2025
3 checks passed
@mclueppers mclueppers deleted the feat/re-factor-defense-mechanisms branch December 24, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant