File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
javascript/ql/src/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,9 @@ private module Octokit {
62
62
private class RequestClientRequest extends ClientRequest:: Range , API:: CallNode {
63
63
RequestClientRequest ( ) { this = requestCallee ( ) .getACall ( ) }
64
64
65
- override DataFlow:: Node getUrl ( ) { none ( ) }
65
+ override DataFlow:: Node getUrl ( ) {
66
+ result = this .getArgument ( 0 ) // contains both the method and the URL, but it's close enough
67
+ }
66
68
67
69
override DataFlow:: Node getHost ( ) { none ( ) }
68
70
@@ -96,7 +98,22 @@ private module GraphQLLib {
96
98
.getALocalSource ( )
97
99
.getAPropertyWrite ( "query" )
98
100
.getRhs ( )
101
+ |
102
+ containsGraphQLIndicator ( req .getUrl ( ) )
99
103
)
100
104
}
101
105
}
106
+
107
+ /**
108
+ * Holds if `node` is a node that likely contains an URL to a GraphQL endpoint.
109
+ */
110
+ private predicate containsGraphQLIndicator ( DataFlow:: Node node ) {
111
+ node .getStringValue ( ) .regexpMatch ( "(?i).*graphql.*" )
112
+ or
113
+ node .( DataFlow:: PropRead ) .getPropertyName ( ) .regexpMatch ( "(?i).*graphql.*" )
114
+ or
115
+ containsGraphQLIndicator ( node .( StringOps:: Concatenation ) .getAnOperand ( ) )
116
+ or
117
+ containsGraphQLIndicator ( node .getAPredecessor ( ) )
118
+ }
102
119
}
You can’t perform that action at this time.
0 commit comments