Code review

This commit is contained in:
edvraa
2021-05-04 19:03:58 +03:00
committed by Chris Smowton
parent 7e1c57689b
commit 8414759f7d
4 changed files with 8 additions and 15 deletions

View File

@@ -11,19 +11,19 @@
import go
import DataFlow::PathGraph
/**
* RSA key length data flow tracking configuration.
*/
class RsaKeyTrackingConfiguration extends DataFlow::Configuration {
RsaKeyTrackingConfiguration() { this = "RsaKeyTrackingConfiguration" }
override predicate isSource(DataFlow::Node source) {
exists(ValueExpr c |
source.asExpr() = c and
c.getIntValue() < 2048
)
source.asExpr().(ValueExpr).getIntValue() < 2048
}
override predicate isSink(DataFlow::Node sink) {
exists(CallExpr c |
sink.asExpr() = c.getArgument(1) and
exists(DataFlow::CallNode c |
sink = c.getArgument(1) and
c.getTarget().hasQualifiedName("crypto/rsa", "GenerateKey")
)
}

View File

@@ -13,4 +13,4 @@ func main() {
fmt.Println(err)
}
fmt.Println(pvk)
}
}

View File

@@ -13,4 +13,4 @@ func main() {
fmt.Println(err)
}
fmt.Println(pvk)
}
}

View File

@@ -25,10 +25,3 @@ func foo4() {
func foo5(size int) {
rsa.GenerateKey(rand.Reader, size)
}
func main() {
foo1()
foo2()
foo3()
foo4()
}