Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 43de6ea

Browse files
author
Sauyon Lee
committed
Update XPathExpressionString to match the Range pattern
Fixes #367
1 parent 5bdff0f commit 43de6ea

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

ql/src/semmle/go/frameworks/XPath.qll

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,25 @@ import go
66

77
/** Provides classes for working with XPath-related APIs. */
88
module XPath {
9+
/**
10+
* A data-flow node whose string value is interpreted as (part of) an XPath expression.
11+
*
12+
* Extend this class to refine existing API models. If you want to model new APIs,
13+
* extend `XPath::XPathExpressionString::Range` instead.
14+
*/
15+
class XPathExpressionString extends DataFlow::Node {
16+
XPathExpressionString::Range self;
17+
18+
XPathExpressionString() { this = self }
19+
}
20+
921
/** Provides classes for working with XPath expression strings. */
1022
module XPathExpressionString {
1123
/**
1224
* A data-flow node whose string value is interpreted as (part of) an XPath expression.
1325
*
14-
* Extend this class to model new APIs.
26+
* Extend this class to model new APIs. If you want to refine existing API models,
27+
* extend `XPath::XPathExpressionString` instead.
1528
*/
1629
abstract class Range extends DataFlow::Node { }
1730

ql/src/semmle/go/security/XPathInjectionCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ module XPathInjection {
3636

3737
/** An XPath expression string, considered as a taint sink for XPath injection. */
3838
class XPathExpressionStringAsSink extends Sink {
39-
XPathExpressionStringAsSink() { this instanceof XPath::XPathExpressionString::Range }
39+
XPathExpressionStringAsSink() { this instanceof XPath::XPathExpressionString }
4040
}
4141
}

0 commit comments

Comments
 (0)