-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathPostMessageStar.ql
More file actions
24 lines (22 loc) · 882 Bytes
/
PostMessageStar.ql
File metadata and controls
24 lines (22 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* @name Cross-window communication with unrestricted target origin
* @description When sending sensitive information to another window using `postMessage`,
* the origin of the target window should be restricted to avoid unintentional
* information leaks.
* @kind path-problem
* @problem.severity error
* @security-severity 4.3
* @precision high
* @id js/cross-window-information-leak
* @tags security
* external/cwe/cwe-201
* external/cwe/cwe-359
*/
import javascript
import semmle.javascript.security.dataflow.PostMessageStarQuery
import DataFlow::PathGraph
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
where cfg.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
"Sensitive data returned from $@ is sent to another window without origin restriction.",
source.getNode(), "here"