File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
javascript/ql/src/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ module Express {
44
44
isRouter ( e , _)
45
45
or
46
46
e .getType ( ) .hasUnderlyingType ( "express" , "Router" )
47
+ or
48
+ // created by `webpack-dev-server`
49
+ WebpackDevServer:: webpackDevServerApp ( ) .flowsToExpr ( e )
47
50
}
48
51
49
52
/**
@@ -903,4 +906,32 @@ module Express {
903
906
904
907
override DataFlow:: ValueNode getARouteHandlerArg ( ) { result = routeHandlerArg }
905
908
}
909
+
910
+ private module WebpackDevServer {
911
+ /**
912
+ * Gets a source for the options given to an instantiation of `webpack-dev-server`.
913
+ */
914
+ private DataFlow:: SourceNode devServerOptions ( DataFlow:: TypeBackTracker t ) {
915
+ t .start ( ) and
916
+ result =
917
+ DataFlow:: moduleImport ( "webpack-dev-server" )
918
+ .getAnInstantiation ( )
919
+ .getArgument ( 1 )
920
+ .getALocalSource ( )
921
+ or
922
+ exists ( DataFlow:: TypeBackTracker t2 | result = devServerOptions ( t2 ) .backtrack ( t2 , t ) )
923
+ }
924
+
925
+ /**
926
+ * Gets an instance of the `express` app created by `webpack-dev-server`.
927
+ */
928
+ DataFlow:: ParameterNode webpackDevServerApp ( ) {
929
+ result =
930
+ devServerOptions ( DataFlow:: TypeBackTracker:: end ( ) )
931
+ .getAPropertyWrite ( [ "after" , "before" , "setup" ] )
932
+ .getRhs ( )
933
+ .getAFunctionValue ( )
934
+ .getParameter ( 0 )
935
+ }
936
+ }
906
937
}
You can’t perform that action at this time.
0 commit comments