Check a URL for SSRF Threats in Node.JS

Cloudmersive
1 min readFeb 26, 2021

Testing URLs on the front-end of a process is a simple action that can save you from future headaches. Using the following API, you can automatically test a URL for Server Side Request Forgery (SSRF) threats in Node.JS. This will ensure your web applications remain secure from these custom-made attacks.

To start the process, we will first run this command to install the SDK:

npm install cloudmersive-validate-api-client --save

Or, add this snippet to your package.json:

"dependencies": {
"cloudmersive-validate-api-client": "^1.3.9"
}

Once the installation is complete, we are ready to call the function with the following code:

var CloudmersiveValidateApiClient = require('cloudmersive-validate-api-client');
var defaultClient = CloudmersiveValidateApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveValidateApiClient.DomainApi();var request = new CloudmersiveValidateApiClient.UrlSsrfRequestFull(); // UrlSsrfRequestFull | Input URL requestvar callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.domainSsrfCheck(request, callback);

The returned response will indicate whether the URL is safe, as well as the threat level.

--

--

Cloudmersive

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