rspec/rules/S4817/vbnet/rule.adoc
Fred Tingaud 51369b610e
Make sure that includes are always surrounded by empty lines (#2270)
When an include is not surrounded by empty lines, its content is inlined
on the same line as the adjacent content. That can lead to broken tags
and other display issues.
This PR fixes all such includes and introduces a validation step that
forbids introducing the same problem again.
2023-06-22 10:38:01 +02:00

55 lines
2.3 KiB
Plaintext

Executing XPATH expressions is security-sensitive. It has led in the past to the following vulnerabilities:
* http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6272[CVE-2016-6272]
* http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-9149[CVE-2016-9149]
* http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-4837[CVE-2012-4837]
User-provided data such as URL parameters should always be considered as untrusted and tainted. Constructing XPath expressions directly from tainted data enables attackers to inject specially crafted values that changes the initial meaning of the expression itself. Successful XPath injections attacks can read sensitive information from the XML document.
This rule will create issues when the following methods are called:
* ``++System.Xml.XmlNode.SelectNodes(string)++``
* ``++System.Xml.XmlNode.SelectNodes(string, System.Xml.XmlNamespaceManager)++``
* ``++System.Xml.XmlNode.SelectSingleNode(string)++``
* ``++System.Xml.XmlNode.SelectSingleNode(string, System.Xml.XmlNamespaceManager)++``
* ``++System.Xml.XPath.XPathNavigator.Compile(string)++``
* ``++System.Xml.XPath.XPathNavigator.Evaluate(string)++``
* ``++System.Xml.XPath.XPathNavigator.Evaluate(string, System.Xml.IXmlNamespaceResolver)++``
* ``++System.Xml.XPath.XPathNavigator.Matches(string)++``
* ``++System.Xml.XPath.XPathNavigator.Select(string)++``
* ``++System.Xml.XPath.XPathNavigator.Select(string, System.Xml.IXmlNamespaceResolver)++``
* ``++System.Xml.XPath.XPathNavigator.SelectSingleNode(string)++``
* ``++System.Xml.XPath.XPathNavigator.SelectSingleNode(string, System.Xml.IXmlNamespaceResolver)++``
* ``++System.Xml.XPath.XPathExpression.Compile(string)++``
* ``++System.Xml.XPath.XPathExpression.Compile(string, System.Xml.IXmlNamespaceResolver)++``
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
== Sensitive Code Example
----
Dim expression As String = "/users/user[@name='" + user + "' and @pass='" + pass + "']"
xpathNavigator.Evaluate(expression); ' Sensitive. Check if the XPATH expression is safe.
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]