Skip to content

Commit 07d5bec

Browse files
committed
run format document
1 parent 26401fe commit 07d5bec

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

ruby/ql/src/experimental/cwe-208/UnsafeHmacComparison.ql

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* @name Unsafe HMAC Comparison
33
* @description An HMAC is being compared using the equality operator. This may be vulnerable to a cryptographic timing attack
44
* because the equality operation does not occur in constant time."
5-
65
* @kind path-problem
76
* @problem.severity error
87
* @security-severity 6.0
@@ -12,7 +11,7 @@
1211
* external/cwe/cwe-208
1312
*/
1413

15-
14+
private import codeql.ruby.AST
1615
private import codeql.ruby.DataFlow
1716
import codeql.ruby.ApiGraphs
1817
import ruby
@@ -29,19 +28,17 @@ private class OpenSslHmacSource extends DataFlow::Node {
2928

3029
private module UnsafeHmacComparison {
3130
private module Config implements DataFlow::ConfigSig {
32-
predicate isSource(DataFlow::Node source) {
33-
source instanceof OpenSslHmacSource
34-
}
31+
predicate isSource(DataFlow::Node source) { source instanceof OpenSslHmacSource }
3532

36-
// Holds if a given sink is an Equality Operation (== or !=)
37-
predicate isSink(DataFlow::Node sink) {
38-
any(EqualityOperation eqOp).getAnOperand() = sink.asExpr().getExpr()
39-
}
33+
// Holds if a given sink is an Equality Operation (== or !=)
34+
predicate isSink(DataFlow::Node sink) {
35+
any(EqualityOperation eqOp).getAnOperand() = sink.asExpr().getExpr()
36+
}
4037
}
4138

4239
import DataFlow::Global<Config>
4340
}
4441

4542
from UnsafeHmacComparison::PathNode source, UnsafeHmacComparison::PathNode sink
4643
where UnsafeHmacComparison::flowPath(source, sink)
47-
select sink.getNode(), source, sink, "This comparison is potentially vulnerable to a timing attack."
44+
select sink.getNode(), source, sink, "This comparison is potentially vulnerable to a timing attack."

0 commit comments

Comments
 (0)