Skip to content

Commit 5af739d

Browse files
authored
Merge pull request #10413 from erik-krogh/go-followMsg
GO: make the alert messages of taint-tracking queries more consistent
2 parents 9979fa3 + 175d3ac commit 5af739d

File tree

50 files changed

+317
-319
lines changed

Some content is hidden

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

50 files changed

+317
-319
lines changed

go/ql/src/InconsistentCode/ConstantLengthComparison.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ where
3030
cond.dominates(idx.getBasicBlock()) and
3131
// and that check happens inside the loop body
3232
cond.getCondition().getParent+() = fs
33-
select cond.getCondition(),
34-
"This checks the length against a constant, but it is indexed using a variable $@.", idx, "here"
33+
select cond.getCondition(), "This checks the length against a constant, but it $@.", idx,
34+
"is indexed using a variable"

go/ql/src/InconsistentCode/MissingErrorCheck.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ where
116116
// `deref` dereferences `ptr`
117117
deref.getOperand() = ptr.getAUse()
118118
select deref.getOperand(),
119-
ptr.getSourceVariable() + " may be nil here, because $@ may not have been checked.", err,
120-
err.getSourceVariable().toString()
119+
"$@ may be nil at this dereference because $@ may not have been checked.", ptr,
120+
ptr.getSourceVariable().toString(), err, err.getSourceVariable().toString()

go/ql/src/RedundantCode/CompareIdenticalValues.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ where
2424
cmp.getAnOperand() = decl.getAReference() and
2525
cmp.getAnOperand() instanceof BasicLit
2626
)
27-
select cmp, "This expression compares $@ to itself.", cmp.getLeftOperand(), "an expression"
27+
select cmp, "This expression compares an $@ to itself.", cmp.getLeftOperand(), "expression"

go/ql/src/RedundantCode/DuplicateCondition.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ GVN conditionGvn(IfStmt is, int i, Expr e) {
3030

3131
from IfStmt is, Expr e, Expr f, int i, int j
3232
where conditionGvn(is, i, e) = conditionGvn(is, j, f) and i < j
33-
select f, "This condition is a duplicate of $@.", e, "an earlier condition"
33+
select f, "This condition is a duplicate of an $@.", e, "earlier condition"

go/ql/src/RedundantCode/DuplicateSwitchCase.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ GVN switchCaseGvn(SwitchStmt switch, int i, Expr e) {
2020

2121
from SwitchStmt switch, int i, Expr e, int j, Expr f
2222
where switchCaseGvn(switch, i, e) = switchCaseGvn(switch, j, f) and i < j
23-
select f, "This case is a duplicate of $@.", e, "an earlier case"
23+
select f, "This case is a duplicate of an $@.", e, "earlier case"

go/ql/src/RedundantCode/SelfAssignment.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ from PotentialSelfAssignment assgn, HashableNode rhs
2323
where
2424
rhs = assgn.getRhs() and
2525
rhs.hash() = assgn.getLhs().(HashableNode).hash()
26-
select assgn, "This statement assigns $@ to itself.", rhs, "an expression"
26+
select assgn, "This statement assigns an $@ to itself.", rhs, "expression"

go/ql/src/Security/CWE-020/IncompleteHostnameRegexp.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ from Config c, DataFlow::PathNode source, DataFlow::PathNode sink, string hostPa
110110
where c.hasFlowPath(source, sink) and c.isSource(source.getNode(), hostPart)
111111
select source, source, sink,
112112
"This regular expression has an unescaped dot before '" + hostPart + "', " +
113-
"so it might match more hosts than expected when used $@.", sink, "here"
113+
"so it might match more hosts than expected when $@.", sink, "the regular expression is used"

go/ql/src/Security/CWE-020/SuspiciousCharacterInRegexp.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ class Config extends DataFlow::Configuration {
4848

4949
from Config c, DataFlow::PathNode source, DataFlow::PathNode sink, string report
5050
where c.hasFlowPath(source, sink) and c.isSource(source.getNode(), report)
51-
select source, source, sink, "$@ used $@ contains " + report, source, "A regular expression", sink,
52-
"here"
51+
select source, source, sink, "$@ that is $@ contains " + report, source, "A string literal", sink,
52+
"used as a regular expression"

go/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 a $@.", source.getNode(),
25+
"user-provided value"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ from
1919
CommandInjection::Configuration cfg, CommandInjection::DoubleDashSanitizingConfiguration cfg2,
2020
DataFlow::PathNode source, DataFlow::PathNode sink
2121
where cfg.hasFlowPath(source, sink) or cfg2.hasFlowPath(source, sink)
22-
select sink.getNode(), source, sink, "This command depends on $@.", source.getNode(),
23-
"a user-provided value"
22+
select sink.getNode(), source, sink, "This command depends on a $@.", source.getNode(),
23+
"user-provided value"

0 commit comments

Comments
 (0)