Files
codeql/ruby/ql/test/query-tests/security/cwe-295/Httparty.rb
2021-10-15 11:47:28 +02:00

37 lines
823 B
Ruby

require "httparty"
# BAD
HTTParty.get("http://example.com/", verify: false)
# BAD
HTTParty.get("http://example.com/", verify_peer: false)
# BAD
HTTParty.get("http://example.com/", { verify_peer: false })
# BAD
HTTParty.post("http://example.com/", body: "some_data", verify: false)
# BAD
HTTParty.post("http://example.com/", { body: "some_data", verify: false })
# GOOD
HTTParty.get("http://example.com/")
# GOOD
HTTParty.get("http://example.com/", verify: true)
# GOOD
HTTParty.get("http://example.com/", verify_peer: true)
# GOOD
HTTParty.post("http://example.com/", body: "some_data")
# GOOD
HTTParty.post("http://example.com/", body: "some_data", verify: true)
# GOOD
HTTParty.post("http://example.com/", { body: "some_data" })
# GOOD
HTTParty.post("http://example.com/", { body: "some_data", verify: true })