feat(devops): add WAF smoke test and mounted Coraza config - #165
Merged
Merged
Conversation
Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
This PR improves local and CI verification of the HAProxy + Coraza WAF datapath by (1) mounting Coraza configuration/rules into the Compose stack for easy iteration, and (2) adding an end-to-end smoke test (plus docs + a scheduled/manual GitHub Actions workflow) that asserts benign traffic is allowed and SQLi traffic is blocked.
Changes:
- Mount Coraza SPOA config, Coraza directives, CRS setup, and CRS rules read-only into the
corazaCompose service. - Add
benchmarks/smoke/e2e.shto stand up the Compose stack and assert 200 (benign) vs 403 (SQLi) through HAProxy+Coraza. - Document smoke test usage and add a nightly/manual
.github/workflows/smoke.ymlworkflow.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| deploy/docker/docker-compose.yml | Adds read-only mounts so Coraza loads host-side config/CRS on container restart. |
| configs/coraza/README.md | Documents the new Compose mount behaviour and how to reload Coraza. |
| benchmarks/smoke/e2e.sh | New smoke-test script that orchestrates Compose, waits for health, and validates 200/403 behaviour. |
| README.testing.md | Documents local prerequisites and how to run the E2E smoke test. |
| README.commands.md | Adds quick commands for restarting Coraza after config edits and running the smoke test. |
| .github/workflows/smoke.yml | Adds scheduled + manual GitHub Actions workflow to run the smoke test in CI. |
Comment on lines
+29
to
+34
| echo "Smoke test failed. Recent HAProxy and Coraza logs:" | ||
| "${COMPOSE[@]}" logs --tail=50 haproxy coraza || true | ||
| fi | ||
|
|
||
| "${COMPOSE[@]}" down -v | ||
| exit "${status}" |
There was a problem hiding this comment.
Done in 7b24560. Two changes applied:
- Added
SMOKE_PROJECT(defaulting toguard-proxy-smoke) and passed--project-name "${SMOKE_PROJECT}"to both thedocker composeanddocker-composevariants, so the smoke test always runs in an isolated project whose volumes are completely separate from a developer's default stack. - Changed
down -vtodown -v || trueso a cleanup failure cannot mask the original test exit status.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bihius/guard-proxy/sessions/ac461107-c9ed-4579-bcd9-a9167687456f Co-authored-by: bihius <119067436+bihius@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
bash -n benchmarks/smoke/e2e.shdocker-compose -f deploy/docker/docker-compose.yml --env-file deploy/docker/.env config >/dev/nullbash benchmarks/smoke/e2e.shuv run pytest --cov=appuv run mypy app/uv run ruff check app/pnpm run type-checkpnpm run lintpnpm run testdocker run --rm -v "$PWD/configs/haproxy:/usr/local/etc/haproxy:ro" haproxy:3.0-alpine haproxy -c -f /usr/local/etc/haproxy/haproxy.cfgCloses #7
Closes #108