You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Repeated headers cause problems in json audit logs #2777
Current implementation of json audit logs generates log entries with duplicated keys in the event of repeated headers in either the request or response. This is technically not invalid json per RFC 7159 Section 4, but most implementations silently drop all-but-first or all-but-last instances of duplicated keys. In some cases however, the behavior is undefined and an error is thrown. I found this issue in the nginx repo outlining a similar difficulty. The prevailing idea over there seemed to be to convert repeated header fields into a single array value containing all of the previously enumerated values. The HTTP specification states in RFC 9110 Section 5.2 that field values for repeated headers should be able to be concatenated delimited by commas. I think either of these are reasonable solutions with pros and cons...
Arrays
Pros:
Can easily handle different data types
Cons:
Less aligned with typical representations of multiple values for a single header
Actually the issue that you found ( owasp-modsecurity/ModSecurity-nginx#230 ) is exactly the same issue. Or, more precisely, that other issue is describing two sub-issues, one of which is the json-formatting issue for duplicates.
Revisiting this one. Confirmed in the JSON writer (src/transaction.cc): the request and response headers objects are emitted with one LOGFY_ADD per header value, so repeated headers produce duplicate keys in the same object. Emitting an array when a name repeats, as @martinhsv preferred, is a contained change in that loop (collect by name first, then write string or array). Marking as a bug.
Activity
martinhsv commentedon Jul 26, 2022
Hi @jbohanon ,
Actually the issue that you found ( owasp-modsecurity/ModSecurity-nginx#230 ) is exactly the same issue. Or, more precisely, that other issue is describing two sub-issues, one of which is the json-formatting issue for duplicates.
As you may gathered from my comments at owasp-modsecurity/ModSecurity-nginx#230 (comment) , I do prefer the array format as the solution.
fzipi commentedon Oct 12, 2026
Revisiting this one. Confirmed in the JSON writer (
src/transaction.cc): the request and responseheadersobjects are emitted with oneLOGFY_ADDper header value, so repeated headers produce duplicate keys in the same object. Emitting an array when a name repeats, as @martinhsv preferred, is a contained change in that loop (collect by name first, then write string or array). Marking as a bug.A repeated header is one key of the JSON audit log