@@ -7,7 +7,6 @@ private import codeql.ruby.CFG
7
7
private import codeql.ruby.Concepts
8
8
private import codeql.ruby.ApiGraphs
9
9
private import codeql.ruby.DataFlow
10
- private import codeql.ruby.dataflow.internal.DataFlowImplForHttpClientLibraries as DataFlowImplForHttpClientLibraries
11
10
12
11
/**
13
12
* A call that makes an HTTP request using `HTTParty`.
@@ -57,26 +56,21 @@ class HttpartyRequest extends Http::Client::Request::Range, DataFlow::CallNode {
57
56
override predicate disablesCertificateValidation (
58
57
DataFlow:: Node disablingNode , DataFlow:: Node argumentOrigin
59
58
) {
60
- any ( HttpartyDisablesCertificateValidationConfiguration config )
61
- .hasFlow ( argumentOrigin , disablingNode ) and
59
+ HttpartyDisablesCertificateValidationFlow:: flow ( argumentOrigin , disablingNode ) and
62
60
disablingNode = this .getCertificateValidationControllingValue ( )
63
61
}
64
62
65
63
override string getFramework ( ) { result = "HTTParty" }
66
64
}
67
65
68
66
/** A configuration to track values that can disable certificate validation for Httparty. */
69
- private class HttpartyDisablesCertificateValidationConfiguration extends DataFlowImplForHttpClientLibraries:: Configuration
70
- {
71
- HttpartyDisablesCertificateValidationConfiguration ( ) {
72
- this = "HttpartyDisablesCertificateValidationConfiguration"
73
- }
74
-
75
- override predicate isSource ( DataFlow:: Node source ) {
76
- source .asExpr ( ) .getExpr ( ) .( BooleanLiteral ) .isFalse ( )
77
- }
67
+ private module HttpartyDisablesCertificateValidationConfig implements DataFlow:: ConfigSig {
68
+ predicate isSource ( DataFlow:: Node source ) { source .asExpr ( ) .getExpr ( ) .( BooleanLiteral ) .isFalse ( ) }
78
69
79
- override predicate isSink ( DataFlow:: Node sink ) {
70
+ predicate isSink ( DataFlow:: Node sink ) {
80
71
sink = any ( HttpartyRequest req ) .getCertificateValidationControllingValue ( )
81
72
}
82
73
}
74
+
75
+ private module HttpartyDisablesCertificateValidationFlow =
76
+ DataFlow:: Global< HttpartyDisablesCertificateValidationConfig > ;
0 commit comments