Skip to content

Commit dd50fe3

Browse files
authored
Merge pull request #10726 from erik-krogh/go-last-msg
Go: fix some more style-guide violations in the alert-messages
2 parents 4d75d88 + 99b7c77 commit dd50fe3

File tree

16 files changed

+62
-59
lines changed

16 files changed

+62
-59
lines changed

go/ql/lib/semmle/go/security/InsecureRandomnessCustomizations.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module InsecureRandomness {
6464
)
6565
}
6666

67-
override string getKind() { result = "this cryptographic algorithm" }
67+
override string getKind() { result = "This cryptographic algorithm" }
6868
}
6969

7070
/**
@@ -75,7 +75,7 @@ module InsecureRandomness {
7575
this.getRoot().(FuncDef).getName().regexpMatch("(?i).*(gen(erate)?|salt|make|mk)Password.*")
7676
}
7777

78-
override string getKind() { result = "a password-related function" }
78+
override string getKind() { result = "A password-related function" }
7979
}
8080

8181
/** Gets a package that implements hash algorithms. */

go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ where
6161
// }
6262
n = DataFlow::BarrierGuard<nilTestGuard/3>::getABarrierNode()
6363
)
64-
select n, "The first argument to 'errors.Wrap' is always nil"
64+
select n, "The first argument to 'errors.Wrap' is always nil."

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

Lines changed: 1 addition & 1 deletion
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, "$@ that is $@ contains " + report, source, "A string literal", sink,
51+
select source, source, sink, "This string literal that is $@ contains " + report, sink,
5252
"used as a regular expression"

go/ql/src/Security/CWE-117/LogInjection.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import DataFlow::PathGraph
1717

1818
from LogInjection::Configuration c, DataFlow::PathNode source, DataFlow::PathNode sink
1919
where c.hasFlowPath(source, sink)
20-
select sink.getNode(), source, sink, "Log entry depends on a $@.", source.getNode(),
20+
select sink.getNode(), source, sink, "This log entry depends on a $@.", source.getNode(),
2121
"user-provided value"

go/ql/src/Security/CWE-338/InsecureRandomness.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ where
1919
cfg.hasFlowPath(source, sink) and
2020
cfg.isSink(sink.getNode(), kind) and
2121
(
22-
kind != "a password-related function"
22+
kind != "A password-related function"
2323
or
2424
sink =
2525
min(DataFlow::PathNode sink2, int line |
@@ -31,5 +31,5 @@ where
3131
)
3232
)
3333
select sink.getNode(), source, sink,
34-
"$@ generated with a cryptographically weak RNG is used in $@.", source.getNode(),
35-
"A random number", sink.getNode(), kind
34+
kind + " depends on a $@ generated with a cryptographically weak RNG.", source.getNode(),
35+
"random number"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The alert message of many queries have been changed to better follow the style guide and make the message consistent with other languages.

go/ql/src/experimental/CWE-369/DivideByZero.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,4 @@ class DivideByZeroCheckConfig extends TaintTracking::Configuration {
5454

5555
from DataFlow::PathNode source, DataFlow::PathNode sink, DivideByZeroCheckConfig cfg
5656
where cfg.hasFlowPath(source, sink)
57-
select sink, source, sink, "Variable $@ might be zero leading to a division-by-zero panic.", sink,
58-
sink.getNode().toString()
57+
select sink, source, sink, "This variable might be zero leading to a division-by-zero panic."

go/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ query predicate edges(CallGraphNode pred, CallGraphNode succ) {
6666

6767
from LoopStmt loop, DatabaseAccess dbAccess
6868
where edges*(loop, dbAccess.asExpr())
69-
select dbAccess, loop, dbAccess, "$@ is called in $@", dbAccess, dbAccess.toString(), loop, "a loop"
69+
select dbAccess, loop, dbAccess, "This calls " + dbAccess.toString() + " in a $@.", loop, "loop"

go/ql/src/experimental/CWE-918/SSRF.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ from
1919
where
2020
cfg.hasFlowPath(source, sink) and
2121
request = sink.getNode().(ServerSideRequestForgery::Sink).getARequest()
22-
select request, source, sink, "The URL of this request depends on a user-provided value"
22+
select request, source, sink, "The URL of this request depends on a user-provided value."

go/ql/src/experimental/IntegerOverflow/IntegerOverflow.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ import RangeAnalysis
1111

1212
from Expr expr
1313
where exprMayOverflow(expr) or exprMayUnderflow(expr)
14-
select expr, "this expression may cause an integer overflow"
14+
select expr, "This expression may cause an integer overflow."

0 commit comments

Comments
 (0)