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 {
6262 private class RequestClientRequest extends ClientRequest:: Range , API:: CallNode {
6363 RequestClientRequest ( ) { this = requestCallee ( ) .getACall ( ) }
6464
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+ }
6668
6769 override DataFlow:: Node getHost ( ) { none ( ) }
6870
@@ -96,7 +98,22 @@ private module GraphQLLib {
9698 .getALocalSource ( )
9799 .getAPropertyWrite ( "query" )
98100 .getRhs ( )
101+ |
102+ containsGraphQLIndicator ( req .getUrl ( ) )
99103 )
100104 }
101105 }
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+ }
102119}
You can’t perform that action at this time.
0 commit comments