Allow connectors to avoid unused intervention log payload overhead - #1
Open
upgle wants to merge 1 commit into
Open
Allow connectors to avoid unused intervention log payload overhead#1upgle wants to merge 1 commit into
upgle wants to merge 1 commit into
Conversation
upgle
marked this pull request as ready for review
July 31, 2026 16:07
There was a problem hiding this comment.
Pull request overview
Adds an instance-scoped switch to let connectors skip generating the human-readable ModSecurityIntervention::log payload (while preserving disruptive behavior and other logging channels), plus regression coverage and a reproducible benchmark/plot workflow to quantify the savings.
Changes:
- Introduces C++ and C APIs to enable/disable intervention log payload generation (default: enabled).
- Centralizes all intervention-log payload producers behind a single helper that respects the instance setting.
- Adds regression tests and a benchmark + deterministic SVG renderer, with a dedicated GitHub Actions validation workflow.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/test-suite.in | Registers the new regression JSON in the automake test list. |
| test/test-cases/regression/intervention-log.json | Adds regression cases covering default behavior, C/C++ APIs, status/actions preservation, and body-limit paths. |
| test/regression/regression.cc | Captures whether an intervention occurred and whether a payload was present, then asserts expected behavior. |
| test/regression/regression_test.h | Extends the test model with payload enablement inputs and payload presence/content expectations. |
| test/regression/regression_test.cc | Parses/serializes the new regression fields from/to JSON. |
| test/common/modsecurity_test_results.h | Adds result fields for intervention seen + payload presence/content. |
| test/common/modsecurity_test_context.h | Adds helpers to reset server-log callbacks while exercising property/state preservation. |
| test/benchmark/plot_intervention_log_benchmark.py | Adds a stdlib-only deterministic SVG renderer for paired benchmark results (with accessibility metadata). |
| test/benchmark/Makefile.am | Builds the new intervention_log_benchmark tool. |
| test/benchmark/intervention_log_benchmark.cc | Adds a paired microbenchmark that toggles the payload setting and writes CSV + summary. |
| test/benchmark/evidence/README.md | Documents the committed benchmark evidence bundle and reproduction steps. |
| test/benchmark/evidence/intervention-log-run-30621986766.svg | Commits an example generated paired estimation plot as evidence. |
| test/benchmark/evidence/intervention-log-run-30621986766.csv | Commits the raw CSV backing the example plot. |
| src/transaction.cc | Routes body-limit intervention log strings through the new payload-setting-aware helper. |
| src/modsecurity.cc | Preserves the reserved payload bit across setServerLogCb calls; implements the new C++/C APIs. |
| src/Makefile.am | Adds the new internal header to the build sources list. |
| src/intervention_log.h | Introduces intervention::setLogPayload(...) helpers gated by the instance setting. |
| src/actions/disruptive/redirect.cc | Uses the centralized helper instead of always formatting/allocating the intervention log payload. |
| src/actions/disruptive/drop.cc | Uses the centralized helper instead of always formatting/allocating the intervention log payload. |
| src/actions/disruptive/deny.cc | Uses the centralized helper instead of always formatting/allocating the intervention log payload. |
| headers/modsecurity/modsecurity.h | Declares the new public APIs and reserves a private bit in m_logProperties with a non-overlap assertion. |
| .github/workflows/intervention-log-validation.yml | Adds a targeted CI workflow to build, run the regression subset, benchmark, and upload artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Allow C and C++ connectors to omit unused intervention log text while preserving disruptive actions and all other logging channels. Keep the default behavior and v3 object layout unchanged, and cover every current payload-producing path with regression tests.
upgle
force-pushed
the
feature/intervention-log-opt-out
branch
from
August 1, 2026 02:56
331b5e3 to
1e16589
Compare
Owner
Author
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.
what
ModSecurityIntervention::logpayload generationAPI
modsecurity.setInterventionLogPayloadEnabled(false);Payload generation remains enabled by default; the C API treats any nonzero value as enabled. The setting is scoped to a
ModSecurityinstance; configure it before publishing to worker threads. Changing it during active transactions is unsupported.The implementation reuses a reserved private log-property bit, adding no object field or virtual function. Existing callback setters preserve the bit.
why
The need surfaced while testing ModSecurity in an Envoy integration. The connector consumes intervention status, redirect URLs, and bounded structured rule events, but not the free-form
ModSecurityIntervention::logpayload; ModSecurity still formats, allocates, copies, and frees it on disruptive requests. This opt-out is intended for high-throughput or latency-sensitive connectors with the same usage pattern while preserving intervention behavior and other logging channels.An isolated Linux release microbenchmark used 12 alternating-order paired rounds with 50,000 transactions per sample. Enabled and disabled medians were 20.290 and 14.735 microseconds per transaction; the 5.541-microsecond median paired difference represents 27.3% lower phase-1 deny time, with all 12 pairs favoring omission.