Skip to content

Commit ea580cd

Browse files
committed
C++: Add explanatory comments.
1 parent 901919f commit ea580cd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cpp/ql/src/Security/CWE/CWE-319/UseOfHttp.ql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@ class HttpStringLiteral extends StringLiteral {
5151
class HttpStringToUrlOpenConfig extends TaintTracking::Configuration {
5252
HttpStringToUrlOpenConfig() { this = "HttpStringToUrlOpenConfig" }
5353

54-
override predicate isSource(DataFlow::Node src) { src.asExpr() instanceof HttpStringLiteral }
54+
override predicate isSource(DataFlow::Node src) {
55+
// Sources are strings containing an HTTP URL not in a private domain.
56+
src.asExpr() instanceof HttpStringLiteral
57+
}
5558

5659
override predicate isSink(DataFlow::Node sink) {
60+
// Sinks can be anything that demonstrates the string is likely to be
61+
// accessed as a URL, for example using it in a network access. Some
62+
// URLs are only ever displayed or used for data processing.
5763
exists(FunctionCall fc |
5864
fc.getTarget().hasGlobalOrStdName(["system", "gethostbyname", "getaddrinfo"]) and
5965
sink.asExpr() = fc.getArgument(0)

0 commit comments

Comments
 (0)