Skip to content

Commit 6da4aa0

Browse files
committed
JS: Tweak performance of CorsOriginHeaderWithAssociatedCredentialHeader
On databases with a large number of Exprs, it can be better to start with the set of route handlers, then find their response headers, then find the expression values set in those headers.
1 parent a82b5ed commit 6da4aa0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/CorsMisconfigurationForCredentialsCustomizations.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ module CorsMisconfigurationForCredentials {
5050
|
5151
routeHandler.getAResponseHeader(_) = origin and
5252
routeHandler.getAResponseHeader(_) = credentials and
53-
origin.definesExplicitly("access-control-allow-origin", this.asExpr()) and
54-
credentials.definesExplicitly("access-control-allow-credentials", credentialsValue)
53+
// Performance optimisation: start with the set of all route handlers
54+
// rather than the set of all exprs.
55+
pragma[only_bind_into](origin)
56+
.definesExplicitly("access-control-allow-origin", this.asExpr()) and
57+
pragma[only_bind_into](credentials)
58+
.definesExplicitly("access-control-allow-credentials", credentialsValue)
5559
|
5660
credentialsValue.mayHaveBooleanValue(true) or
5761
credentialsValue.mayHaveStringValue("true")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy