File tree Expand file tree Collapse file tree 3 files changed +10
-12
lines changed
javascript/ql/lib/semmle/javascript/frameworks Expand file tree Collapse file tree 3 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import javascript
6
6
7
7
/** Provides classes modeling the apollo packages [@apollo/server](https://npmjs.com/package/@apollo/server`) */
8
8
module Apollo {
9
- /** Get an instanceof of `Apollo` */
9
+ /** Get a reference to the `ApolloServer` class. */
10
10
private API:: Node apollo ( ) {
11
11
result =
12
12
API:: moduleImport ( [
@@ -30,7 +30,7 @@ module Apollo {
30
30
}
31
31
32
32
/** A string that is interpreted as a GraphQL query by a `apollo` package. */
33
- class ApolloGraphQLString extends GraphQL:: GraphQLString {
33
+ private class ApolloGraphQLString extends GraphQL:: GraphQLString {
34
34
ApolloGraphQLString ( ) { this = gql ( ) .getACall ( ) .getArgument ( 0 ) }
35
35
}
36
36
}
Original file line number Diff line number Diff line change 4
4
5
5
import javascript
6
6
7
- /** Provides classes modeling [cors package ](https://npmjs.com/package/cors) */
7
+ /** Provides classes modeling [cors](https://npmjs.com/package/cors) library. */
8
8
module Cors {
9
9
/**
10
10
* An expression that creates a new CORS configuration.
11
11
*/
12
12
class Cors extends DataFlow:: CallNode {
13
- /** Get an instanceof of `cors` */
14
13
Cors ( ) { this = DataFlow:: moduleImport ( "cors" ) .getAnInvocation ( ) }
15
14
16
- /** Get Cors configuration */
17
- DataFlow:: Node getCorsArgument ( ) { result = this .getArgument ( 0 ) }
15
+ /** Get the options used to configure Cors */
16
+ DataFlow:: Node getOptionsArgument ( ) { result = this .getArgument ( 0 ) }
18
17
19
18
/** Holds if cors is using default configuration */
20
19
predicate isDefault ( ) { this .getNumArgument ( ) = 0 }
21
20
22
21
/** Gets the value of origin */
23
22
DataFlow:: Node getOrigin ( ) {
24
- result = this .getCorsArgument ( ) . getALocalSource ( ) . getAPropertyWrite ( "origin" ) . getRhs ( )
23
+ result = this .getOptionArgument ( 0 , "origin" )
25
24
}
26
25
}
27
26
}
Original file line number Diff line number Diff line change @@ -1074,21 +1074,20 @@ module Express {
1074
1074
}
1075
1075
1076
1076
/**
1077
- * The CORS configuration used in Express
1077
+ * An express route setup configured with the `cors` package.
1078
1078
*/
1079
1079
class CorsConfiguration extends DataFlow:: MethodCallNode {
1080
- /** Get an `app.use` with a cors object as argument */
1081
1080
CorsConfiguration ( ) {
1082
1081
this = appCreation ( ) .getAMethodCall ( "use" ) and this .getArgument ( 0 ) instanceof Cors:: Cors
1083
1082
}
1084
1083
1085
- /** Get Cors configuration */
1084
+ /** Gets the options used to configure `cors`. */
1086
1085
DataFlow:: Node getCorsArgument ( ) { result = this .getArgument ( 0 ) .( Cors:: Cors ) .getCorsArgument ( ) }
1087
1086
1088
- /** Holds if cors is using default configuration */
1087
+ /** Holds if cors is using its default configuration. */
1089
1088
predicate isDefault ( ) { this .getArgument ( 0 ) .( Cors:: Cors ) .isDefault ( ) }
1090
1089
1091
- /** Get Cors origin value */
1090
+ /** Gets the ` origin` option that the call to `cors` is configured with. */
1092
1091
DataFlow:: Node getOrigin ( ) { result = this .getArgument ( 0 ) .( Cors:: Cors ) .getOrigin ( ) }
1093
1092
}
1094
1093
}
You can’t perform that action at this time.
0 commit comments