Skip to content

Commit 6fff028

Browse files
committed
Ruby: Fix bug in disablesCertificateValidation
1 parent 570a03a commit 6fff028

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ruby/ql/lib/codeql/ruby/frameworks/ActiveResource.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ module ActiveResource {
9393

9494
/** Holds if this site value specifies HTTP rather than HTTPS. */
9595
predicate disablesCertificateValidation() {
96-
this.getAUrlPart().asExpr().getConstantValue().getString().regexpMatch("^http(^s)")
96+
this.getAUrlPart()
97+
.asExpr()
98+
.(ExprNodes::AssignExprCfgNode)
99+
.getRhs()
100+
.getConstantValue()
101+
.getString()
102+
.regexpMatch("^http[^s].+")
97103
}
98104
}
99105

ruby/ql/test/library-tests/frameworks/active_resource/ActiveResource.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
modelClasses
22
| active_resource.rb:1:1:3:3 | Person | active_resource.rb:2:3:2:11 | call to site= | false |
3-
| active_resource.rb:29:1:31:3 | Post | active_resource.rb:30:3:30:11 | call to site= | false |
3+
| active_resource.rb:29:1:31:3 | Post | active_resource.rb:30:3:30:11 | call to site= | true |
44
modelClassMethodCalls
55
| active_resource.rb:2:3:2:11 | call to site= |
66
| active_resource.rb:5:9:5:33 | call to new |

0 commit comments

Comments
 (0)