@@ -71,14 +71,19 @@ private predicate isSslOptionsPairDisablingValidation(Pair p) {
7171 exists ( DataFlow:: Node key , DataFlow:: Node value |
7272 key .asExpr ( ) .getExpr ( ) = p .getKey ( ) and value .asExpr ( ) .getExpr ( ) = p .getValue ( )
7373 |
74- exists ( DataFlow:: LocalSourceNode literal |
75- literal .asExpr ( ) .getExpr ( ) .( SymbolLiteral ) .getValueText ( ) = "ssl" and
76- literal .flowsTo ( key )
77- ) and
74+ isSymbolLiteral ( key , "ssl" ) and
7875 ( isHashWithVerifyFalse ( value ) or isHashWithVerifyModeNone ( value ) )
7976 )
8077}
8178
79+ /** Holds if `node` represents the symbol literal with the given `valueText`. */
80+ private predicate isSymbolLiteral ( DataFlow:: Node node , string valueText ) {
81+ exists ( DataFlow:: LocalSourceNode literal |
82+ literal .asExpr ( ) .getExpr ( ) .( SymbolLiteral ) .getValueText ( ) = valueText and
83+ literal .flowsTo ( node )
84+ )
85+ }
86+
8287/**
8388 * Holds if `node` represents a hash containing the key-value pair
8489 * `verify: false`.
@@ -109,10 +114,7 @@ private predicate isVerifyModeNonePair(Pair p) {
109114 exists ( DataFlow:: Node key , DataFlow:: Node value |
110115 key .asExpr ( ) .getExpr ( ) = p .getKey ( ) and value .asExpr ( ) .getExpr ( ) = p .getValue ( )
111116 |
112- exists ( DataFlow:: LocalSourceNode literal |
113- literal .asExpr ( ) .getExpr ( ) .( SymbolLiteral ) .getValueText ( ) = "verify_mode" and
114- literal .flowsTo ( key )
115- ) and
117+ isSymbolLiteral ( key , "verify_mode" ) and
116118 value = API:: getTopLevelMember ( "OpenSSL" ) .getMember ( "SSL" ) .getMember ( "VERIFY_NONE" ) .getAUse ( )
117119 )
118120}
@@ -124,21 +126,15 @@ private predicate isVerifyFalsePair(Pair p) {
124126 exists ( DataFlow:: Node key , DataFlow:: Node value |
125127 key .asExpr ( ) .getExpr ( ) = p .getKey ( ) and value .asExpr ( ) .getExpr ( ) = p .getValue ( )
126128 |
127- exists ( DataFlow:: LocalSourceNode literal |
128- literal .asExpr ( ) .getExpr ( ) .( SymbolLiteral ) .getValueText ( ) = "verify" and
129- literal .flowsTo ( key )
130- ) and
131- isFalsey ( value )
129+ isSymbolLiteral ( key , "verify" ) and
130+ isFalse ( value )
132131 )
133132}
134133
135- /** Holds if `node` contains `0` or `false`. */
136- private predicate isFalsey ( DataFlow:: Node node ) {
134+ /** Holds if `node` can contain the Boolean value `false`. */
135+ private predicate isFalse ( DataFlow:: Node node ) {
137136 exists ( DataFlow:: LocalSourceNode literal |
138- (
139- literal .asExpr ( ) .getExpr ( ) .( BooleanLiteral ) .isFalse ( ) or
140- literal .asExpr ( ) .getExpr ( ) .( IntegerLiteral ) .getValue ( ) = 0
141- ) and
137+ literal .asExpr ( ) .getExpr ( ) .( BooleanLiteral ) .isFalse ( ) and
142138 literal .flowsTo ( node )
143139 )
144140}
0 commit comments