@@ -89,17 +89,59 @@ abstract class CookieSet extends CookieOperation {}
8989/** Generic taint sink in a http response */
9090abstract class HttpResponseTaintSink extends TaintSink {
9191
92- override predicate sinks ( TaintKind kind ) {
92+ override predicate sinks ( TaintKind kind ) {
9393 kind instanceof ExternalStringKind
9494 }
9595
9696}
9797
9898abstract class HttpRedirectTaintSink extends TaintSink {
9999
100- override predicate sinks ( TaintKind kind ) {
100+ override predicate sinks ( TaintKind kind ) {
101101 kind instanceof ExternalStringKind
102102 }
103103
104104}
105105
106+ module Client {
107+
108+ // TODO: user-input in other than URL:
109+ // - `data`, `json` for `requests.post`
110+ // - `body` for `HTTPConnection.request`
111+ // - headers?
112+
113+ // TODO: Add more library support
114+ // - urllib3 https://github.com/urllib3/urllib3
115+ // - httpx https://github.com/encode/httpx
116+
117+ /**
118+ * An outgoing http request
119+ *
120+ * For example:
121+ * conn = HTTPConnection('example.com')
122+ conn.request('GET', '/path')
123+ */
124+ abstract class HttpRequest extends CallNode {
125+
126+ /** Get any ControlFlowNode that is used to construct the final URL.
127+ *
128+ * In the HTTPConnection example, there is a result for both `'example.com'` and for `'/path'`.
129+ */
130+ abstract ControlFlowNode getAUrlPart ( ) ;
131+
132+ abstract string getMethodUpper ( ) ;
133+ }
134+
135+ /** Taint sink for the URL-part of an outgoing http request */
136+ class HttpRequestUrlTaintSink extends TaintSink {
137+
138+ HttpRequestUrlTaintSink ( ) {
139+ this = any ( HttpRequest r ) .getAUrlPart ( )
140+ }
141+
142+ override predicate sinks ( TaintKind kind ) {
143+ kind instanceof ExternalStringKind
144+ }
145+
146+ }
147+ }
0 commit comments