cloudmersive.security
Module cloudmersive.security
API
Definitions
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
cloudmersive.security: Client
This is a generated connector from Cloudmersive OpenAPI specification. The Cloudmersive Security APIs help you detect and block security threats.
Constructor
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, ConnectionConfig config, string serviceUrl)
- apiKeyConfig ApiKeysConfig - API keys for authorization
- config ConnectionConfig {} - The configurations to be used when initializing the
connector
- serviceUrl string "https://testapi.cloudmersive.com/" - URL of the target service
contentThreatDetectionAutomaticThreatDetectionString
function contentThreatDetectionAutomaticThreatDetectionString(string payload) returns StringAutomaticThreatDetection|error
Automatically detect threats in an input string
Parameters
- payload string - User-facing text input.
Return Type
contentThreatDetectionDetectInsecureDeserializationJsonString
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
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
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
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
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
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
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
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
cloudmersive.security: ApiKeysConfig
Provides API key configurations needed when communicating with a remote HTTP endpoint.
Fields
- apikey string - Represents API Key
Apikey
cloudmersive.security: ClientHttp1Settings
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
cloudmersive.security: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
cloudmersive.security: IPThreatDetectionResponse
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: ProxyConfig
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
cloudmersive.security: StringAutomaticThreatDetection
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
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
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
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
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
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
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
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
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 1 year ago
Version: 1.5.1
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Pull count
Total: 0
Current verison: 0
Weekly downloads
Keywords
IT Operations/Security & Identity Tools
Cost/Freemium
Contributors
Dependencies