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
It's impossible to get the actual error message produced by libxml2 when there's an issue with passed XML data.
While in some cases it's easy to get the required data by e.g. running xmllint against the payload (if it's known), in other cases it can be quite hard to understand what's went wrong (see e.g. owasp-modsecurity/ModSecurity-nginx#246).
To Reproduce
Let's consider inherently incorrect XML like this:
Clear and unambiguous message (parser error : Opening and ending tag mismatch [..]) as emitted by xmllint instead of cryptic "Failed to parse request body" or "XML: failed parsing document".
Server (please complete the following information):
ModSecurity version (and connector): v3/master (v3.0.4-119-g1376882f), ModSecurity-nginx (v1.0.1-23-g21bc821)
WebServer: nginx/1.19.10
Rule Set (please complete the following information):
No actual ruleset involved, just plain modsecurity.conf from the v3/master.
Additional context
With the following dummy patch I was able to get the actual error message to a file:
Describe the bug
It's impossible to get the actual error message produced by libxml2 when there's an issue with passed XML data.
While in some cases it's easy to get the required data by e.g. running
xmllint
against the payload (if it's known), in other cases it can be quite hard to understand what's went wrong (see e.g. owasp-modsecurity/ModSecurity-nginx#246).To Reproduce
Let's consider inherently incorrect XML like this:
Here's the output of
xmllint
:Now we push it to the nginx with modsecurity enabled:
Logs and dumps
Output of:
Expected behavior
Clear and unambiguous message (
parser error : Opening and ending tag mismatch [..]
) as emitted byxmllint
instead of cryptic "Failed to parse request body" or "XML: failed parsing document".Server (please complete the following information):
Rule Set (please complete the following information):
No actual ruleset involved, just plain modsecurity.conf from the v3/master.
Additional context
With the following dummy patch I was able to get the actual error message to a file:
File contents:
(It's just for a demo, of course I'm sure there must be a better way of handling this so the error(s) would go to appropriate context / loggers.)
The text was updated successfully, but these errors were encountered: