-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathPostMessageStar.ql
More file actions
23 lines (21 loc) · 889 Bytes
/
PostMessageStar.ql
File metadata and controls
23 lines (21 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* @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 PostMessageStarFlow::PathGraph
from PostMessageStarFlow::PathNode source, PostMessageStarFlow::PathNode sink
where PostMessageStarFlow::flowPath(source, sink)
select sink.getNode(), source, sink, "$@ is sent to another window without origin restriction.",
source.getNode(), "Sensitive data"