Skip to content

Commit 0720fa7

Browse files
authored
Merge pull request #10286 from erik-krogh/js-followMsg
JS: change alert messages of path queries to use the same template
2 parents cbb64cc + 87fb01d commit 0720fa7

File tree

69 files changed

+800
-802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+800
-802
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/CodeInjectionCustomizations.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module CodeInjection {
1919
/**
2020
* Gets the substitute for `X` in the message `User-provided value flows to X`.
2121
*/
22-
string getMessageSuffix() { result = "here and is interpreted as code" }
22+
string getMessageSuffix() { result = "this location and is interpreted as code" }
2323
}
2424

2525
/**
@@ -126,7 +126,8 @@ module CodeInjection {
126126
}
127127

128128
override string getMessageSuffix() {
129-
result = "here and is interpreted by " + templateType + ", which may evaluate it as code"
129+
result =
130+
"this location and is interpreted by " + templateType + ", which may evaluate it as code"
130131
}
131132
}
132133

@@ -288,7 +289,7 @@ module CodeInjection {
288289
/** A sink for code injection via template injection. */
289290
abstract private class TemplateSink extends Sink {
290291
override string getMessageSuffix() {
291-
result = "here and is interpreted as a template, which may contain code"
292+
result = "this location and is interpreted as a template, which may contain code"
292293
}
293294
}
294295

javascript/ql/lib/semmle/javascript/security/dataflow/HardcodedDataInterpretedAsCodeCustomizations.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module HardcodedDataInterpretedAsCode {
5454

5555
override DataFlow::FlowLabel getLabel() { result.isTaint() }
5656

57-
override string getKind() { result = "code" }
57+
override string getKind() { result = "Code" }
5858
}
5959

6060
/**
@@ -65,6 +65,6 @@ module HardcodedDataInterpretedAsCode {
6565

6666
override DataFlow::FlowLabel getLabel() { result.isDataOrTaint() }
6767

68-
override string getKind() { result = "an import path" }
68+
override string getKind() { result = "An import path" }
6969
}
7070
}

javascript/ql/lib/semmle/javascript/security/dataflow/RemotePropertyInjectionCustomizations.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module RemotePropertyInjection {
4747
exists(DeleteExpr expr | expr.getOperand().(PropAccess).getPropertyNameExpr() = astNode)
4848
}
4949

50-
override string getMessage() { result = " a property name to write to." }
50+
override string getMessage() { result = "A property name to write to" }
5151
}
5252

5353
/**
@@ -65,6 +65,6 @@ module RemotePropertyInjection {
6565
)
6666
}
6767

68-
override string getMessage() { result = " a header name." }
68+
override string getMessage() { result = "A header name" }
6969
}
7070
}

javascript/ql/src/Security/CWE-022/TaintedPath.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ import DataFlow::PathGraph
2121

2222
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
2323
where cfg.hasFlowPath(source, sink)
24-
select sink.getNode(), source, sink, "$@ flows to here and is used in a path.", source.getNode(),
25-
"User-provided value"
24+
select sink.getNode(), source, sink, "This path depends on $@.", source.getNode(),
25+
"a user-provided value"

javascript/ql/src/Security/CWE-022/ZipSlip.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ import DataFlow::PathGraph
1818

1919
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
2020
where cfg.hasFlowPath(source, sink)
21-
select source.getNode(), source, sink,
22-
"Unsanitized archive entry, which may contain '..', is used in a $@.", sink.getNode(),
23-
"file system operation"
21+
select source.getNode(), source, sink, "$@ depends on $@ which may contain '..'", sink.getNode(),
22+
"File system operation", source.getNode(), "unsanitized archive entry"

javascript/ql/src/Security/CWE-073/TemplateObjectInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import semmle.javascript.security.dataflow.TemplateObjectInjectionQuery
1717

1818
from DataFlow::Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
1919
where cfg.hasFlowPath(source, sink)
20-
select sink.getNode(), source, sink, "Template object injection due to $@.", source.getNode(),
21-
"user-provided value"
20+
select sink.getNode(), source, sink, "Template object depends on $@.", source.getNode(),
21+
"a user-provided value"

javascript/ql/src/Security/CWE-078/CommandInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ where
2828
else highlight = sink.getNode()
2929
) and
3030
sourceNode = source.getNode()
31-
select highlight, source, sink, "$@ flows to here and is used in a command.", source.getNode(),
32-
sourceNode.getSourceType()
31+
select highlight, source, sink, "Command line depends on $@.", source.getNode(),
32+
"a user-provided value"

javascript/ql/src/Security/CWE-078/UnsafeShellCommandConstruction.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ import DataFlow::PathGraph
1919

2020
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink, Sink sinkNode
2121
where cfg.hasFlowPath(source, sink) and sinkNode = sink.getNode()
22-
select sinkNode.getAlertLocation(), source, sink, "$@ based on $@ is later used in $@.",
22+
select sinkNode.getAlertLocation(), source, sink, "$@ which depends on $@ is later used in $@.",
2323
sinkNode.getAlertLocation(), sinkNode.getSinkType(), source.getNode(), "library input",
24-
sinkNode.getCommandExecution(), "shell command"
24+
sinkNode.getCommandExecution(), "a shell command"

javascript/ql/src/Security/CWE-079/UnsafeHtmlConstruction.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ import semmle.javascript.security.dataflow.UnsafeHtmlConstructionQuery
1818

1919
from DataFlow::Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink, Sink sinkNode
2020
where cfg.hasFlowPath(source, sink) and sink.getNode() = sinkNode
21-
select sinkNode, source, sink, "$@ based on $@ might later cause $@.", sinkNode,
21+
select sinkNode, source, sink, "$@ which depends on $@ might later allow $@.", sinkNode,
2222
sinkNode.describe(), source.getNode(), "library input", sinkNode.getSink(),
2323
sinkNode.getVulnerabilityKind().toLowerCase()

javascript/ql/src/Security/CWE-094/ImproperCodeSanitization.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ where
6868
sink.getNode().(StringOps::ConcatenationLeaf).getRoot() = endsInCodeInjectionSink() and
6969
remoteFlow() = source.getNode().(DataFlow::InvokeNode).getAnArgument()
7070
)
71-
select sink.getNode(), source, sink, "$@ flows to here and is used to construct code.",
72-
source.getNode(), "Improperly sanitized value"
71+
select sink.getNode(), source, sink, "Code construction depends on $@.", source.getNode(),
72+
"an improperly sanitized value"

0 commit comments

Comments
 (0)