File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
lib/codeql/ruby/frameworks/http_clients
test/library-tests/frameworks/http_clients Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,10 @@ private import codeql.ruby.DataFlow
21
21
class NetHttpRequest extends HTTP:: Client:: Request:: Range {
22
22
private DataFlow:: CallNode request ;
23
23
private DataFlow:: Node responseBody ;
24
+ private API:: Node requestNode ;
24
25
25
26
NetHttpRequest ( ) {
26
- exists ( API :: Node requestNode , string method |
27
+ exists ( string method |
27
28
request = requestNode .getAnImmediateUse ( ) and
28
29
this = request .asExpr ( ) .getExpr ( )
29
30
|
@@ -48,10 +49,19 @@ class NetHttpRequest extends HTTP::Client::Request::Range {
48
49
}
49
50
50
51
/**
51
- * Gets the node representing the URL of the request.
52
- * Currently unused, but may be useful in future, e.g. to filter out certain requests.
52
+ * Gets a node that contributes to the URL of the request.
53
53
*/
54
- override DataFlow:: Node getAUrlPart ( ) { result = request .getArgument ( 0 ) }
54
+ override DataFlow:: Node getAUrlPart ( ) {
55
+ result = request .getArgument ( 0 )
56
+ or
57
+ // Net::HTTP.new(...).get(...)
58
+ exists ( API:: Node new |
59
+ new = API:: getTopLevelMember ( "Net" ) .getMember ( "HTTP" ) .getInstance ( ) and
60
+ requestNode = new .getReturn ( _)
61
+ |
62
+ result = new .getAnImmediateUse ( ) .( DataFlow:: CallNode ) .getArgument ( 0 )
63
+ )
64
+ }
55
65
56
66
override DataFlow:: Node getResponseBody ( ) { result = responseBody }
57
67
Original file line number Diff line number Diff line change 48
48
| NetHttp.rb:6:8:6:50 | call to post | Net::HTTP | NetHttp.rb:6:23:6:36 | call to parse | NetHttp.rb:7:1:7:9 | call to body |
49
49
| NetHttp.rb:6:8:6:50 | call to post | Net::HTTP | NetHttp.rb:6:23:6:36 | call to parse | NetHttp.rb:8:1:8:14 | call to read_body |
50
50
| NetHttp.rb:6:8:6:50 | call to post | Net::HTTP | NetHttp.rb:6:23:6:36 | call to parse | NetHttp.rb:9:1:9:11 | call to entity |
51
+ | NetHttp.rb:13:6:13:17 | call to get | Net::HTTP | NetHttp.rb:11:21:11:41 | "https://example.com" | NetHttp.rb:18:1:18:7 | call to body |
51
52
| NetHttp.rb:13:6:13:17 | call to get | Net::HTTP | NetHttp.rb:13:14:13:16 | "/" | NetHttp.rb:18:1:18:7 | call to body |
53
+ | NetHttp.rb:14:6:14:18 | call to post | Net::HTTP | NetHttp.rb:11:21:11:41 | "https://example.com" | NetHttp.rb:19:1:19:12 | call to read_body |
52
54
| NetHttp.rb:14:6:14:18 | call to post | Net::HTTP | NetHttp.rb:14:15:14:17 | "/" | NetHttp.rb:19:1:19:12 | call to read_body |
55
+ | NetHttp.rb:15:6:15:17 | call to put | Net::HTTP | NetHttp.rb:11:21:11:41 | "https://example.com" | NetHttp.rb:20:1:20:9 | call to entity |
53
56
| NetHttp.rb:15:6:15:17 | call to put | Net::HTTP | NetHttp.rb:15:14:15:16 | "/" | NetHttp.rb:20:1:20:9 | call to entity |
57
+ | NetHttp.rb:24:3:24:33 | call to get | Net::HTTP | NetHttp.rb:24:17:24:22 | domain | NetHttp.rb:27:1:27:28 | call to body |
54
58
| NetHttp.rb:24:3:24:33 | call to get | Net::HTTP | NetHttp.rb:24:29:24:32 | path | NetHttp.rb:27:1:27:28 | call to body |
55
59
| OpenURI.rb:3:9:3:41 | call to open | OpenURI | OpenURI.rb:3:21:3:40 | "http://example.com" | OpenURI.rb:4:1:4:10 | call to read |
56
60
| OpenURI.rb:6:9:6:34 | call to open | OpenURI | OpenURI.rb:6:14:6:33 | "http://example.com" | OpenURI.rb:7:1:7:15 | call to readlines |
You can’t perform that action at this time.
0 commit comments