mirror of
https://github.com/github/codeql.git
synced 2025-12-20 02:44:30 +01:00
Update javascript/ql/src/experimental/Security/CWE-020/PostMessageNoOriginCheck.ql
Co-authored-by: Esben Sparre Andreasen <esbena@github.com>
This commit is contained in:
committed by
GitHub
parent
72dc6510b2
commit
8843522d14
@@ -49,11 +49,9 @@ class PostMessageEvent extends DataFlow::SourceNode {
|
||||
* Holds if an access on `MessageEvent.origin` is in an `EqualityTest` and there is no call of an insufficient verification method on `MessageEvent.origin`
|
||||
*/
|
||||
predicate hasOriginChecked() {
|
||||
exists(string prop | prop = "origin" or prop = "source" |
|
||||
astNode.getAnOperand().(PropAccess).accesses(event, prop) and
|
||||
event.mayReferToParameter*(this.asExpr()) and
|
||||
not this.hasOriginInsufficientlyChecked()
|
||||
)
|
||||
exists(EqualityTest test |
|
||||
this.getAPropertyRead(["origin", "source"]).flowsToExpr(test.getAnOperand())
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user