Check HTML Text for SSRF Threats in Ruby

Server-side request forgery (SSRF) attacks are a type of threat that has become increasingly common. These attacks are frequently deployed through infected URLs, but they can be deployed via HTML injection as well. Regardless of the way they reach your server, the potential damage they can cause by obtaining control of web application requests is the same. By running the following API in Ruby, you will be able to automatically check HTML text for SSRF threats, providing a more secure experience for you and your users.

To begin the process, we will install the Ruby client:

gem 'cloudmersive-validate-api-client', '~> 2.1.6'

Next, we can add our HTML text input and API key into the below example code to call the function:

# load the gem
require 'cloudmersive-validate-api-client'
# setup authorization
CloudmersiveValidateApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'
end
api_instance = CloudmersiveValidateApiClient::TextInputApi.newvalue = 'value_example' # String | User-facing HTML input.begin
#Protect html input from Server-side Request Forgery (SSRF) attacks
result = api_instance.text_input_check_html_ssrf(value)
p result
rescue CloudmersiveValidateApiClient::ApiError => e
puts "Exception when calling TextInputApi->text_input_check_html_ssrf: #{e}"
end

If you need to retrieve an API key, head over to the Cloudmersive website to register for a free account; this will provide 800 calls/month across our library of APIs.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.