Files
codeql/ruby/ql/test/query-tests/security/cwe-295/Httparty.rb
2026-06-15 23:03:46 +01:00

38 lines
874 B
Ruby

require "httparty"
# BAD
HTTParty.get("http://example.com/", verify: false) # $ Alert
# BAD
HTTParty.get("http://example.com/", verify_peer: false) # $ Alert
# BAD
HTTParty.get("http://example.com/", { verify_peer: false }) # $ Alert
# BAD
HTTParty.post("http://example.com/", body: "some_data", verify: false) # $ Alert
# BAD
HTTParty.post("http://example.com/", { body: "some_data", verify: false }) # $ Alert
# 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 })