cloudmersive.security
Module cloudmersive.security
API
Definitions
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_cloudmersive.security_1.1.0.png)
ballerinax/cloudmersive.security Ballerina library
Overview
This is a generated connector from Cloudmersive OpenAPI specification.
The Cloudmersive Security APIs help you detect and block security threats.
Prerequisites
- Create a Cloudmersive account
- Obtain tokens
- Use this guide to obtain the API key related to your account.
Quickstart
To use the Cloudmersive Security connector in your Ballerina application, update the .bal file as follows:
Step 1 - Import connector
First, import the ballerinax/cloudmersive.security module into the Ballerina project.
import ballerinax/cloudmersive.security;
Step 2 - Create a new connector instance
You can now make the connection configuration using the access token.
security:ApiKeysConfig config = { apikey : "<your apiKey>" }; security:Client baseClient = check new Client(clientConfig);
Step 3 - Invoke connector operation
- Scan the query for SQL Injection
string query = "SELECT * FROM Users WHERE UserId = 105 OR 1=1;"; security:StringSqlInjectionDetectionResult|error bEvent = baseClient->contentThreatDetectionCheckSqlInjectionString(query); if (bEvent is security:StringSqlInjectionDetectionResult) { log:printInfo("Threat Report: " + bEvent.toString()); } else { test:assertFail(msg = bEvent.toString()); }
- Use
bal run
command to compile and run the Ballerina program
Clients![](/images/permalink.svg)
cloudmersive.security: Client![](/images/permalink.svg)
This is a generated connector from Cloudmersive OpenAPI specification. The Cloudmersive Security APIs help you detect and block security threats.
Constructor![](/images/permalink.svg)
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create a Cloudmersive account and obtain tokens following this guide.
init (ApiKeysConfig apiKeyConfig, ClientConfiguration clientConfig, string serviceUrl)
- apiKeyConfig ApiKeysConfig - API keys for authorization
- clientConfig ClientConfiguration {} - The configurations to be used when initializing the
connector
- serviceUrl string "https://testapi.cloudmersive.com/" - URL of the target service
contentThreatDetectionAutomaticThreatDetectionString![](/images/permalink.svg)
function contentThreatDetectionAutomaticThreatDetectionString(string payload) returns StringAutomaticThreatDetection|error
Automatically detect threats in an input string
Parameters
- payload string - User-facing text input.
Return Type
contentThreatDetectionDetectInsecureDeserializationJsonString![](/images/permalink.svg)
function contentThreatDetectionDetectInsecureDeserializationJsonString(string payload) returns StringInsecureDeserializationJsonDetection|error
Detect Insecure Deserialization JSON (JID) attacks in a string
Parameters
- payload string - User-facing text input.
Return Type
contentThreatDetectionCheckSqlInjectionString![](/images/permalink.svg)
function contentThreatDetectionCheckSqlInjectionString(string payload) returns StringSqlInjectionDetectionResult|error
Check text input for SQL Injection (SQLI) attacks
Parameters
- payload string - User-facing text input.
Return Type
contentThreatDetectionProtectXss![](/images/permalink.svg)
function contentThreatDetectionProtectXss(string payload) returns StringXssProtectionResult|error
Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
Parameters
- payload string - User-facing text input.
Return Type
contentThreatDetectionCheckXxe![](/images/permalink.svg)
function contentThreatDetectionCheckXxe(string payload) returns StringXxeDetectionResult|error
Protect text input from XML External Entity (XXE) attacks
Parameters
- payload string - User-facing text input.
Return Type
networkThreatDetectionDetectSsrfUrl![](/images/permalink.svg)
function networkThreatDetectionDetectSsrfUrl(UrlSsrfThreatDetectionRequestFull payload) returns UrlSsrfThreatDetectionResponseFull|error
Check a URL for Server-side Request Forgery (SSRF) threats
Parameters
- payload UrlSsrfThreatDetectionRequestFull - Input URL request
Return Type
networkThreatDetectionIsThreat![](/images/permalink.svg)
function networkThreatDetectionIsThreat(string payload) returns IPThreatDetectionResponse|error
Check if IP address is a known threat
Parameters
- payload string - IP address to check, e.g. "55.55.55.55". The input is a string so be sure to enclose it in double-quotes.
Return Type
networkThreatDetectionIsBot![](/images/permalink.svg)
function networkThreatDetectionIsBot(string payload) returns ThreatDetectionBotCheckResponse|error
Check if IP address is a Bot client threat
Parameters
- payload string - IP address to check, e.g. "55.55.55.55". The input is a string so be sure to enclose it in double-quotes.
Return Type
networkThreatDetectionIsTorNode![](/images/permalink.svg)
function networkThreatDetectionIsTorNode(string payload) returns ThreatDetectionTorNodeResponse|error
Check if IP address is a Tor node server
Parameters
- payload string - IP address to check, e.g. "55.55.55.55". The input is a string so be sure to enclose it in double-quotes.
Return Type
Records![](/images/permalink.svg)
cloudmersive.security: ApiKeysConfig![](/images/permalink.svg)
Provides API key configurations needed when communicating with a remote HTTP endpoint.
Fields
- apikey string - Represents API Key
Apikey
cloudmersive.security: IPThreatDetectionResponse![](/images/permalink.svg)
Result of performing a IP threat check on an IP address
Fields
- IsThreat boolean? - True if the input IP address is a threat, false otherwise
- ThreatType string? - Specifies the type of IP threat; possible values include Blocklist, Botnet, WebBot
cloudmersive.security: StringAutomaticThreatDetection![](/images/permalink.svg)
Result of performing an Insecure Deserialization JSON protection operation
Fields
- Successful boolean? - True if the operation was successful, false otherwise
- CleanResult boolean? -
- ContainedJsonInsecureDeserializationAttack boolean? - True if the input contained Insecure Deserialization JSON, false otherwise
- ContainedXssThreat boolean? - True if the input contained XSS attack, false otherwise
- ContainedXxeThreat boolean? - True if the input contained XXE attack, false otherwise
- ContainedSqlInjectionThreat boolean? - True if the input contained SQL Injection attack, false otherwise
- ContainedSsrfThreat boolean? - True if the input contained an Server-Side Request Forgery (SSRF) URL attack, false otherwise
- IsXML boolean? - True if the input string is XML, false otherwise
- IsJSON boolean? - True if the input string is JSON, false otherwise
- IsURL boolean? - True if the input string is a URL, false otherwise
- OriginalInput string? - Original input string
cloudmersive.security: StringInsecureDeserializationJsonDetection![](/images/permalink.svg)
Result of performing an Insecure Deserialization JSON protection operation
Fields
- Successful boolean? - True if the operation was successful, false otherwise
- ContainedJsonInsecureDeserializationAttack boolean? - True if the input contained Insecure Deserialization JSON, false otherwise
- OriginalInput string? - Original input string
cloudmersive.security: StringSqlInjectionDetectionResult![](/images/permalink.svg)
Result of performing an SQL Injection protection operation
Fields
- Successful boolean? - True if the operation was successful, false otherwise
- ContainedSqlInjectionAttack boolean? - True if the input contained SQL Injection attacks, false otherwise
- OriginalInput string? - Original input string
cloudmersive.security: StringXssProtectionResult![](/images/permalink.svg)
Result of performing an XSS protection operation
Fields
- Successful boolean? - True if the operation was successful, false otherwise
- ContainedXss boolean? - True if the input contained XSS scripting, false otherwise
- OriginalInput string? - Original input string
- NormalizedResult string? - Normalized string result, with XSS removed
cloudmersive.security: StringXxeDetectionResult![](/images/permalink.svg)
Result of performing an XXE threat detection operation
Fields
- Successful boolean? - True if the operation was successful, false otherwise
- ContainedXxe boolean? - True if the input contained XXE threats, false otherwise
cloudmersive.security: ThreatDetectionBotCheckResponse![](/images/permalink.svg)
Result of performing a Bot check on an IP address
Fields
- IsBot boolean? - True if the input IP address is a Bot or Robot, false otherwise
cloudmersive.security: ThreatDetectionTorNodeResponse![](/images/permalink.svg)
Result of performing a Tor node check on an IP address
Fields
- IsTorNode boolean? - True if the input IP address is a Tor exit node, false otherwise
cloudmersive.security: UrlSsrfThreatDetectionRequestFull![](/images/permalink.svg)
Request to determine if a URL is an SSRF threat check
Fields
- URL string? - URL to validate
- BlockedDomains string[]? - Top level domains that you do not want to allow access to, e.g. mydomain.com - will block all subdomains as well
cloudmersive.security: UrlSsrfThreatDetectionResponseFull![](/images/permalink.svg)
Result of checking a URL for SSRF threats
Fields
- CleanURL boolean? - True if the URL is clean, false if it is at risk of containing an SSRF threat or attack
- ThreatLevel string? - Threat level of the URL; possible values are High, Medium, Low and None
Import
import ballerinax/cloudmersive.security;
Metadata
Released date: over 2 years ago
Version: 1.1.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: slbeta6
GraalVM compatible: Yes
Pull count
Total: 0
Current verison: 0
Weekly downloads
Keywords
IT Operations/Security & Identity Tools
Cost/Freemium
Contributors
Dependencies