-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnodeIntegration.ql
44 lines (34 loc) · 1.15 KB
/
nodeIntegration.ql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import javascript
/**
* Gets a warning message for `pref` if one of the `nodeIntegration` features is enabled.
*/
class WebPrefTracker extends TaintTracking::Configuration{
WebPrefTracker() {
this = "WebPrefTracker"
}
override predicate isSource(DataFlow::Node nd){
exists( DataFlow::ObjectLiteralNode obj,DataFlow::ObjectLiteralNode pref,DataFlow::Node value|
obj.hasPropertyWrite("webPreferences",pref)
and pref.hasPropertyWrite("nodeIntegration",value)
and value.mayHaveBooleanValue(true)//and value.mayHaveBooleanValue(true)
and nd = obj
)
//any()
}
override predicate isSink(DataFlow::Node nd){
exists(InvokeExpr Ie |
(Ie.getCalleeName() = "BrowserWindow"
or Ie.getCalleeName() = "ElectronWindow"
or Ie.getCalleeName() = "ShadowWindow")
and nd.asExpr() = Ie.getArgument(0)
)
}
}
from WebPrefTracker pt, DataFlow::Node source, DataFlow::Node sink
where pt.hasFlow(source, sink)
select source,sink
/*
from ObjectExpr ob, Property value
where value = ob.getPropertyByName("nodeIntegration")
select ob,value
*/