Skip to content

Commit 635fd19

Browse files
committed
Python: Move HTTP::Client::Request to shared concepts
New shared concepts uses correct casing of HTTP according to our style-guide.
1 parent 9d96b73 commit 635fd19

File tree

2 files changed

+70
-65
lines changed

2 files changed

+70
-65
lines changed

python/ql/lib/semmle/python/Concepts.qll

Lines changed: 3 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,71 +1046,9 @@ module HTTP {
10461046
}
10471047
}
10481048

1049-
/** Provides classes for modeling HTTP clients. */
1050-
module Client {
1051-
/**
1052-
* A data-flow node that makes an outgoing HTTP request.
1053-
*
1054-
* Extend this class to refine existing API models. If you want to model new APIs,
1055-
* extend `HTTP::Client::Request::Range` instead.
1056-
*/
1057-
class Request extends DataFlow::Node instanceof Request::Range {
1058-
/**
1059-
* Gets a data-flow node that contributes to the URL of the request.
1060-
* Depending on the framework, a request may have multiple nodes which contribute to the URL.
1061-
*/
1062-
DataFlow::Node getAUrlPart() { result = super.getAUrlPart() }
1063-
1064-
/** Gets a string that identifies the framework used for this request. */
1065-
string getFramework() { result = super.getFramework() }
1066-
1067-
/**
1068-
* Holds if this request is made using a mode that disables SSL/TLS
1069-
* certificate validation, where `disablingNode` represents the point at
1070-
* which the validation was disabled, and `argumentOrigin` represents the origin
1071-
* of the argument that disabled the validation (which could be the same node as
1072-
* `disablingNode`).
1073-
*/
1074-
predicate disablesCertificateValidation(
1075-
DataFlow::Node disablingNode, DataFlow::Node argumentOrigin
1076-
) {
1077-
super.disablesCertificateValidation(disablingNode, argumentOrigin)
1078-
}
1079-
}
1080-
1081-
/** Provides a class for modeling new HTTP requests. */
1082-
module Request {
1083-
/**
1084-
* A data-flow node that makes an outgoing HTTP request.
1085-
*
1086-
* Extend this class to model new APIs. If you want to refine existing API models,
1087-
* extend `HTTP::Client::Request` instead.
1088-
*/
1089-
abstract class Range extends DataFlow::Node {
1090-
/**
1091-
* Gets a data-flow node that contributes to the URL of the request.
1092-
* Depending on the framework, a request may have multiple nodes which contribute to the URL.
1093-
*/
1094-
abstract DataFlow::Node getAUrlPart();
1095-
1096-
/** Gets a string that identifies the framework used for this request. */
1097-
abstract string getFramework();
1098-
1099-
/**
1100-
* Holds if this request is made using a mode that disables SSL/TLS
1101-
* certificate validation, where `disablingNode` represents the point at
1102-
* which the validation was disabled, and `argumentOrigin` represents the origin
1103-
* of the argument that disabled the validation (which could be the same node as
1104-
* `disablingNode`).
1105-
*/
1106-
abstract predicate disablesCertificateValidation(
1107-
DataFlow::Node disablingNode, DataFlow::Node argumentOrigin
1108-
);
1109-
}
1110-
}
1111-
// TODO: investigate whether we should treat responses to client requests as
1112-
// remote-flow-sources in general.
1113-
}
1049+
import semmle.python.internal.ConceptsShared::Http::Client as Client
1050+
// TODO: investigate whether we should treat responses to client requests as
1051+
// remote-flow-sources in general.
11141052
}
11151053

11161054
/**

python/ql/lib/semmle/python/internal/ConceptsShared.qll

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,70 @@ module Cryptography {
8787
predicate isWeak() { this = "ECB" }
8888
}
8989
}
90+
91+
/** Provides classes for modeling HTTP-related APIs. */
92+
module Http {
93+
/** Provides classes for modeling HTTP clients. */
94+
module Client {
95+
/**
96+
* A data-flow node that makes an outgoing HTTP request.
97+
*
98+
* Extend this class to refine existing API models. If you want to model new APIs,
99+
* extend `Http::Client::Request::Range` instead.
100+
*/
101+
class Request extends DataFlow::Node instanceof Request::Range {
102+
/**
103+
* Gets a data-flow node that contributes to the URL of the request.
104+
* Depending on the framework, a request may have multiple nodes which contribute to the URL.
105+
*/
106+
DataFlow::Node getAUrlPart() { result = super.getAUrlPart() }
107+
108+
/** Gets a string that identifies the framework used for this request. */
109+
string getFramework() { result = super.getFramework() }
110+
111+
/**
112+
* Holds if this request is made using a mode that disables SSL/TLS
113+
* certificate validation, where `disablingNode` represents the point at
114+
* which the validation was disabled, and `argumentOrigin` represents the origin
115+
* of the argument that disabled the validation (which could be the same node as
116+
* `disablingNode`).
117+
*/
118+
predicate disablesCertificateValidation(
119+
DataFlow::Node disablingNode, DataFlow::Node argumentOrigin
120+
) {
121+
super.disablesCertificateValidation(disablingNode, argumentOrigin)
122+
}
123+
}
124+
125+
/** Provides a class for modeling new HTTP requests. */
126+
module Request {
127+
/**
128+
* A data-flow node that makes an outgoing HTTP request.
129+
*
130+
* Extend this class to model new APIs. If you want to refine existing API models,
131+
* extend `Http::Client::Request` instead.
132+
*/
133+
abstract class Range extends DataFlow::Node {
134+
/**
135+
* Gets a data-flow node that contributes to the URL of the request.
136+
* Depending on the framework, a request may have multiple nodes which contribute to the URL.
137+
*/
138+
abstract DataFlow::Node getAUrlPart();
139+
140+
/** Gets a string that identifies the framework used for this request. */
141+
abstract string getFramework();
142+
143+
/**
144+
* Holds if this request is made using a mode that disables SSL/TLS
145+
* certificate validation, where `disablingNode` represents the point at
146+
* which the validation was disabled, and `argumentOrigin` represents the origin
147+
* of the argument that disabled the validation (which could be the same node as
148+
* `disablingNode`).
149+
*/
150+
abstract predicate disablesCertificateValidation(
151+
DataFlow::Node disablingNode, DataFlow::Node argumentOrigin
152+
);
153+
}
154+
}
155+
}
156+
}

0 commit comments

Comments
 (0)