Skip to content

Commit 87cac2a

Browse files
committed
Express Argument has to be Cors
1 parent 83cbbd7 commit 87cac2a

File tree

1 file changed

+7
-1
lines changed
  • javascript/ql/lib/semmle/javascript/frameworks

1 file changed

+7
-1
lines changed

javascript/ql/lib/semmle/javascript/frameworks/Express.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,13 @@ module Express {
10771077
* An express route setup configured with the `cors` package.
10781078
*/
10791079
class CorsConfiguration extends DataFlow::MethodCallNode {
1080-
CorsConfiguration() { exists(Express::RouteSetup setup | this = setup | setup.isUseCall()) }
1080+
CorsConfiguration() {
1081+
exists(Express::RouteSetup setup | this = setup |
1082+
setup.isUseCall() and setup.getArgument(0) instanceof Cors::Cors
1083+
or
1084+
not setup.isUseCall() and setup.getAnArgument() instanceof Cors::Cors
1085+
)
1086+
}
10811087

10821088
/** Gets the cors argument */
10831089
Cors::Cors getArgument() { result = this.getArgument(0) }

0 commit comments

Comments
 (0)