[
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XPath expression with equals sign",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/?key=value&key=other_value",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule XML://bookstore/*[local-name()='some-tag'] \"bbb\" \"id:500012,phase:3,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with On, check if ARGS is populated",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS:xml.bookstore.some-tag \"@rx aaa\" \"id:500012,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with On, check if XML is populated",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule XML:/* \"@rx aaa\" \"id:500012,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with OnlyArgs, check if ARGS is populated",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs OnlyArgs",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS:xml.bookstore.some-tag \"@rx aaa\" \"id:500012,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with OnlyArgs, check if XML is populated",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 200
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs OnlyArgs",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule XML:/* \"@rx aaa\" \"id:500012,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with Off, check if ARGS is populated",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 200
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs Off",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS \"@rx aaa\" \"id:500012,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with Off, check if XML is populated",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs Off",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule XML:/* \"@rx aaa\" \"id:500012,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with On, turn Off with ctl, check ARGS",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/?q=xml",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 200
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS_GET:q \"@rx xml\" \"id:500012,phase:1,t:none,t:lowercase,ctl:parseXmlIntoArgs=Off\"",
      "SecRule ARGS:xml.bookstore.some-tag \"@rx aaa\" \"id:500013,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with On, turn Off with ctl, check XML",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/?q=xml",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS_GET:q \"@rx xml\" \"id:500012,phase:1,t:none,t:lowercase,ctl:parseXmlIntoArgs=Off\"",
      "SecRule XML:/* \"@rx aaa\" \"id:500013,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with On, turn OnlyArgs with ctl, check ARGS",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/?q=xml",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS_GET:q \"@rx xml\" \"id:500012,phase:1,t:none,t:lowercase,ctl:parseXmlIntoArgs=OnlyArgs\"",
      "SecRule ARGS:xml.bookstore.some-tag \"@rx aaa\" \"id:500013,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with On, turn OnlyArgs with ctl, check XML",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/?q=xml",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 200
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS_GET:q \"@rx xml\" \"id:500012,phase:1,t:none,t:lowercase,ctl:parseXmlIntoArgs=OnlyArgs\"",
      "SecRule XML:/* \"@rx aaa\" \"id:500013,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with Off, turn On with ctl, check ARGS",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/?q=xml",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs Off",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS_GET:q \"@rx xml\" \"id:500012,phase:1,t:none,t:lowercase,ctl:parseXmlIntoArgs=On\"",
      "SecRule ARGS:xml.bookstore.some-tag \"@rx aaa\" \"id:500013,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with Off, turn On with ctl, check XML",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "181"
      },
      "uri": "/?q=xml",
      "method": "POST",
      "body": [
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
        "<!DOCTYPE author [",
        "<!ELEMENT book ANY>",
        "<!ENTITY js SYSTEM \"/etc/passwd\">",
        "]>",
        "<bookstore>",
        "<some-tag>aaa</some-tag><some-tag>bbb</some-tag>",
        "</bookstore>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs Off",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS_GET:q \"@rx xml\" \"id:500012,phase:1,t:none,t:lowercase,ctl:parseXmlIntoArgs=On\"",
      "SecRule XML:/* \"@rx aaa\" \"id:500013,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  },
  {
    "enabled": 1,
    "version_min": 300000,
    "title": "Testing XML parsing to ARGS with On, node contains utf8 character",
    "resource": "libxml2",
    "client": {
      "ip": "200.249.12.31",
      "port": 123
    },
    "server": {
      "ip": "200.249.12.31",
      "port": 80
    },
    "request": {
      "headers": {
        "Host": "localhost",
        "User-Agent": "curl/7.38.0",
        "Accept": "*/*",
        "Content-Type": "text/xml",
        "Content-Length": "50"
      },
      "uri": "/?q=xml",
      "method": "POST",
      "body": [
        "<pizza>",
        "<has>pineapple</has><has>🍍</has>",
        "</pizza>"
      ]
    },
    "response": {
      "headers": {
        "Content-Length": "0"
      },
      "body": [
        ""
      ]
    },
    "expected": {
      "http_code": 403
    },
    "rules": [
      "SecRuleEngine On",
      "SecRequestBodyAccess On",
      "SecParseXmlIntoArgs On",
      "SecRule REQUEST_HEADERS:Content-Type \"^text/xml$\" \"id:500011,phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML\"",
      "SecRule ARGS \"@rx 🍍\" \"id:500013,phase:2,t:none,t:lowercase,log,deny,status:403\""
    ]
  }
]
