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
Parser for XML namespaces in xml rules is too restrictive #2358
**Parser for XML namespeces in XML rules is too restrictive **
We encountered a bug when porting mod_security from version 2 to version 3.
The parser, that parses the XML-namespace in XML rules is too restrictive.
It allows only namespaces beginning with http://
[Definition:] The attribute's value, a URI reference, is the namespace name identifying the namespace. The namespace name, to serve its intended purpose, should have the characteristics of uniqueness and persistence. It is not a goal that it be directly usable for retrieval of a schema (if any exists). An example of a syntax that is designed with these goals in mind is that for Uniform Resource Names [RFC2141]. However, it should be noted that ordinary URLs can be managed in such a way as to achieve these same goals.
Thus, namespaces do not always start with http://, but may also start with e.g. uri:
We got the rules loaded and working by just removing the check for http:// in src/actions/xmlns.cc
Revisiting this one, and confirming it. XmlNS::init in src/actions/xmlns.cc rejects any namespace href that does not start with http://, which excludes https://, urn: and every other valid URI reference (the error text, "Missing xmlns href", does not say so either). 2.x has no such check. The fix is to drop that comparison; the href only needs to be non-empty. Marking as a bug; I can open the PR.
Activity
fzipi commentedon Oct 12, 2026
Revisiting this one, and confirming it.
XmlNS::initinsrc/actions/xmlns.ccrejects any namespace href that does not start withhttp://, which excludeshttps://,urn:and every other valid URI reference (the error text, "Missing xmlns href", does not say so either). 2.x has no such check. The fix is to drop that comparison; the href only needs to be non-empty. Marking as a bug; I can open the PR.