-
Notifications
You must be signed in to change notification settings - Fork 7
feat: OWASP Coraza WAF for enhanced security #2538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
…nsitive path protection Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
Co-authored-by: DerekRoberts <4391600+DerekRoberts@users.noreply.github.com>
There was a problem hiding this 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 integrates Coraza WAF v2 with the Caddy server to provide application-layer security against common web attacks including SQL injection, XSS, path traversal, and security scanner detection.
Key Changes:
- Multi-stage Docker build to compile custom Caddy binary with Coraza WAF plugin
- Comprehensive WAF rule configuration with SQL injection, XSS, path traversal, and sensitive path protection
- Updated documentation to reflect the new security feature
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
| frontend/Dockerfile | Adds multi-stage build with xcaddy builder to compile Coraza WAF plugin, creates WAF data directories |
| frontend/coraza.conf | New WAF configuration file with security rules for SQL injection, XSS, path traversal, null byte injection, and sensitive path blocking |
| frontend/Caddyfile | Integrates Coraza WAF by including the configuration file in the global directives block |
| README.md | Updates feature list and stack description to mention Coraza WAF integration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Derek Roberts <derek.roberts@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Derek Roberts <derek.roberts@gmail.com>
- Add 'order coraza_waf first' to Caddyfile global options for proper execution order - Fix /tmp/coraza directory ownership to UID 1001 for non-root user access - Update coraza.conf comment to clarify directory creation in Dockerfile
- Add comprehensive WAF documentation section to README.md - Increase SecRequestBodyNoFilesLimit to 512KB for better API compatibility - Fix SQL injection regex with word boundaries to reduce false positives - Remove 'burp' from User-Agent blocking to allow authorized security testing - Disable SecResponseBodyAccess since no response body rules are configured - Add documentation comments for SecAuditEngine RelevantOnly behavior - Update request body limit documentation with clear breakdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix critical OpenShift UID compatibility: use GID 0 with 770 permissions - Remove unused response body settings when disabled - Remove empty XSS comment section - Renumber rule 1006 to 1005 to fix ID gap - Fix ReDoS vulnerability in SQL comment regex (/\*[^*]*\*+/) - Improve SQL comment pattern to match end of string (--(\s|$))
Description
Integrates Coraza WAF v2 with Caddy server to provide application-layer security against common web attacks.
Fixes #1724
Type of change
Changes
Multi-stage Docker build (
frontend/Dockerfile)xcaddywithgithub.com/corazawaf/coraza-caddy/v2/tmp/coraza/) with 700 permissionsWAF configuration (
frontend/coraza.conf)sp_,xp_,exec)%252e%252e) and mixed-case variants.env,.git,.ssh,.aws,.htaccess,.htpasswd,web.config,admin,config,backup,tmp,logs,wp-admin.editorconfigstandardsCaddyfile integration (
frontend/Caddyfile)Documentation (
README.md)How Has This Been Tested?
WAF functionality will be validated through existing CI/CD pipeline:
Checklist
Further comments
Security rules use defense-in-depth approach:
Regex patterns optimized with lazy matching (
.*?) and word boundaries (\b) to balance security effectiveness with performance and false positive rates.All files follow
.editorconfigstandards with LF line endings and final newlines.References:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in: