Skip to content

Commit 8843522

Browse files
dellaliberaesbena
andauthored
Update javascript/ql/src/experimental/Security/CWE-020/PostMessageNoOriginCheck.ql
Co-authored-by: Esben Sparre Andreasen <esbena@github.com>
1 parent 72dc651 commit 8843522

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

javascript/ql/src/experimental/Security/CWE-020/PostMessageNoOriginCheck.ql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@ class PostMessageEvent extends DataFlow::SourceNode {
4949
* Holds if an access on `MessageEvent.origin` is in an `EqualityTest` and there is no call of an insufficient verification method on `MessageEvent.origin`
5050
*/
5151
predicate hasOriginChecked() {
52-
exists(string prop | prop = "origin" or prop = "source" |
53-
astNode.getAnOperand().(PropAccess).accesses(event, prop) and
54-
event.mayReferToParameter*(this.asExpr()) and
55-
not this.hasOriginInsufficientlyChecked()
56-
)
52+
exists(EqualityTest test |
53+
this.getAPropertyRead(["origin", "source"]).flowsToExpr(test.getAnOperand())
54+
)
5755
}
5856

5957
/**

0 commit comments

Comments
 (0)