11
11
12
12
13
13
import javascript
14
- import DataFlow :: PathGraph
14
+ import ConfigFlow :: PathGraph
15
15
import DataFlow
16
16
import browserextension.BrowserInjectionFieldCustomizations:: BrowserInjection
17
17
private import semmle.javascript.security.dataflow.XssThroughDomCustomizations:: XssThroughDom as XssThroughDom
18
-
18
+
19
19
//private import semmle.javascript.security.dataflow.DomBasedXssCustomizations
20
20
//private import semmle.javascript.security.dataflow.XssThroughDomCustomizations::XssThroughDom as XssThroughDom
21
-
21
+
22
22
//private import semmle.javascript.security.dataflow.CodeInjectionCustomizations
23
-
24
- class Configuration extends TaintTracking:: Configuration {
25
- Configuration ( ) { this = "BrowserInjection" }
26
-
27
- override predicate isSource ( DataFlow:: Node source ) {
23
+
24
+ module Config implements DataFlow:: ConfigSig {
25
+
26
+ predicate isSource ( DataFlow:: Node source ) {
28
27
source instanceof Source
29
28
}
30
-
31
- override predicate isSink ( DataFlow:: Node sink ) {
29
+
30
+ predicate isSink ( DataFlow:: Node sink ) {
32
31
sink instanceof Sink
33
32
}
34
-
35
- override predicate isAdditionalLoadStep ( DataFlow:: Node pred , DataFlow:: Node succ , string prop ) {
36
- ( pred = succ ) and
33
+
34
+ additional predicate isAdditionalLoadStep ( DataFlow:: Node pred , DataFlow:: Node succ , string prop ) {
35
+ ( pred = succ ) and
37
36
( ( pred instanceof Update and prop = [ "url" , "openerTabId" ] )
38
37
or
39
38
( pred instanceof DownloadsDangerous and prop = [ "body" , "conflictAction" , "filename" , "url" , "method" ] )
40
39
or
41
40
( pred instanceof Delete and prop = [ "startTime" , "endTime" , "url" ] )
42
41
//or
43
42
//(pred instanceof SetContentSettings and succ instanceof SetContentSettings and prop = any(string s))
44
- //or
43
+ //or
45
44
//(pred instanceof GetContentSettings and succ instanceof GetContentSettings and prop = any(string s))
46
45
//(pred instanceof StorageSet and succ instanceof StorageSet and prop = any(string s))
47
46
//or
58
57
( pred = succ and pred instanceof CreateWindows and prop = [ "url" ] ) )
59
58
}
60
59
}
61
-
62
-
63
- from Configuration cfg , DataFlow:: PathNode source , DataFlow:: PathNode sink
64
- where cfg .hasFlowPath ( source , sink )
60
+
61
+ module ConfigFlow = TaintTracking:: Global< Config > ;
62
+
63
+
64
+ from ConfigFlow:: PathNode source , ConfigFlow:: PathNode sink
65
+ where ConfigFlow:: flowPath ( source , sink )
65
66
select sink .getNode ( ) , source , sink , sink .getNode ( ) + " depends on a $@." ,
66
67
source .getNode ( ) , "user-provided value"
67
-
68
-
0 commit comments