@@ -2,47 +2,41 @@ import semmle.javascript.dataflow.TaintTracking
2
2
3
3
import ghsl.CommandLine
4
4
5
- class RandomTaintsSourceConfiguration extends TaintTracking :: Configuration {
6
- RandomTaintsSourceConfiguration ( ) { this = "RandomTaintsSourceConfiguration" }
5
+ module RandomTaintsSourceConfig implements DataFlow :: ConfigSig {
6
+ predicate isSource ( DataFlow :: Node source ) { isSecureRandom ( source ) }
7
7
8
- override predicate isSource ( DataFlow:: Node source ) {
9
- isSecureRandom ( source )
10
- }
11
-
12
- override predicate isSink ( DataFlow:: Node sink ) {
13
- not isSecureRandom ( sink )
14
- }
8
+ predicate isSink ( DataFlow:: Node sink ) { not isSecureRandom ( sink ) }
15
9
}
16
10
17
- class InsecureIVConfiguration extends TaintTracking:: Configuration {
18
- InsecureIVConfiguration ( ) { this = "InsecureIVConfiguration" }
11
+ module RandomTaintsSourceFlow = TaintTracking:: Global< RandomTaintsSourceConfig > ;
19
12
20
- override predicate isSource ( DataFlow:: Node source ) {
21
- exists ( Literal literal | literal .flow ( ) = source )
22
- or
23
- source instanceof DataFlow:: ArrayLiteralNode
24
- or
25
- source instanceof RemoteFlowSource
26
- or
27
- source instanceof FileSystemReadAccess
28
- or
29
- source instanceof DatabaseAccess
30
- or
31
- source instanceof CommandLineArgument
32
- or
33
- // an external function that is not a known source of randomness
34
- (
35
- source instanceof ExternalCallWithOutput
36
- and not source instanceof CreateIVArgument
37
- and not source instanceof SecureRandomSource
38
- )
39
- }
13
+ module InsecureIVConfig implements DataFlow:: ConfigSig {
14
+ predicate isSource ( DataFlow:: Node source ) {
15
+ exists ( Literal literal | literal .flow ( ) = source )
16
+ or
17
+ source instanceof DataFlow:: ArrayLiteralNode
18
+ or
19
+ source instanceof RemoteFlowSource
20
+ or
21
+ source instanceof FileSystemReadAccess
22
+ or
23
+ source instanceof DatabaseAccess
24
+ or
25
+ source instanceof CommandLineArgument
26
+ or
27
+ // an external function that is not a known source of randomness
28
+ (
29
+ source instanceof ExternalCallWithOutput
30
+ and not source instanceof CreateIVArgument
31
+ and not source instanceof SecureRandomSource
32
+ )
33
+ }
40
34
41
- override predicate isSink ( DataFlow:: Node sink ) {
42
- sink instanceof CreateIVArgument
43
- }
35
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof CreateIVArgument }
44
36
}
45
37
38
+ module InsecureIVFlow = TaintTracking:: Global< InsecureIVConfig > ;
39
+
46
40
class ExternalCallWithOutput extends DataFlow:: Node {
47
41
CallExpr call ;
48
42
0 commit comments