SDKs overview
Escape provides a suite of Software Development Kits (SDKs) and client libraries designed to facilitate programmatic interaction with its API security platform. These tools enable developers to integrate Escape's automated API penetration testing and vulnerability scanning capabilities directly into their development workflows and continuous integration/continuous deployment (CI/CD) pipelines. By offering language-specific wrappers for the underlying Escape API reference, the SDKs abstract away the complexities of HTTP requests, authentication, and response parsing, allowing developers to focus on implementing security checks.
The SDKs act as a bridge between a developer's application code and the Escape platform, supporting core functions such as initiating scans, retrieving scan results, managing API inventories, and configuring security policies. This integration is crucial for maintaining a proactive API security posture, as it allows for the automated discovery and remediation of vulnerabilities before APIs are deployed to production environments. The availability of SDKs across multiple popular programming languages ensures broad compatibility with diverse development ecosystems.
While official SDKs are maintained directly by Escape, the open nature of API development often encourages community contributions. These community-driven libraries can extend functionality, provide alternative language bindings, or offer specialized integrations not covered by official releases. Developers are encouraged to consult the official Escape documentation for the most up-to-date information on supported SDKs and best practices for integration.
Official SDKs by language
Escape offers official SDKs for several programming languages, each designed to provide a native-like experience for developers working in their preferred environment. These SDKs are maintained by Escape and are the recommended way to interact with the Escape API for most use cases.
| Language | Package Manager | Installation Command | Maturity |
|---|---|---|---|
| Python | pip |
pip install escape-sdk |
Stable |
| Go | go get |
go get github.com/escape-tech/escape-go-sdk |
Stable |
| Java | Maven / Gradle | // Maven:
<dependency>
<groupId>tech.escape</groupId>
<artifactId>escape-java-sdk</artifactId>
<version>1.0.0</version>
</dependency>
// Gradle:
implementation 'tech.escape:escape-java-sdk:1.0.0' |
Stable |
| Node.js | npm / yarn |
npm install @escape.tech/sdk |
Stable |
Each SDK provides a client object that can be initialized with API credentials, typically an API key. This client then exposes methods corresponding to the various API endpoints, allowing for actions such as submitting new API definitions for scanning, querying the status of ongoing scans, and retrieving detailed vulnerability reports. For detailed API key management and authentication flows, developers should consult the Escape API authentication guide.
Installation
Installation of Escape's official SDKs follows standard practices for each respective language's package management ecosystem. Before installing, ensure your development environment meets the minimum requirements specified in the Escape installation documentation.
Python
To install the Python SDK, use pip (Python's package installer):
pip install escape-sdk
It is generally recommended to install Python packages within a Python virtual environment to avoid conflicts with global packages.
Go
For Go projects, use go get to fetch the SDK and add it to your module dependencies:
go get github.com/escape-tech/escape-go-sdk
Ensure your Go environment is configured correctly, typically with GO111MODULE=on for Go modules.
Java
Java SDK installation typically involves adding a dependency to your project's build file, such as Maven's pom.xml or Gradle's build.gradle. The specific version number should be replaced with the latest stable release as found in the Escape Java SDK documentation.
Maven
<dependency>
<groupId>tech.escape</groupId>
<artifactId>escape-java-sdk</artifactId>
<version>1.0.0</version> <!-- Replace with latest version -->
</dependency>
Gradle
implementation 'tech.escape:escape-java-sdk:1.0.0' // Replace with latest version
Node.js
The Node.js SDK can be installed using npm or yarn:
npm
npm install @escape.tech/sdk
yarn
yarn add @escape.tech/sdk
After installation, the package can be imported into your JavaScript or TypeScript projects.
Quickstart example
This Python quickstart demonstrates how to initialize the Escape client, submit an OpenAPI specification for scanning, and retrieve the scan results. This example assumes you have an Escape API key available as an environment variable (ESCAPE_API_KEY) and an openapi.yaml file representing your API definition.
import os
from escape_sdk import EscapeClient
# Initialize the Escape client with your API key
# It's recommended to load the API key from environment variables for security
api_key = os.getenv("ESCAPE_API_KEY")
if not api_key:
raise ValueError("ESCAPE_API_KEY environment variable not set.")
client = EscapeClient(api_key=api_key)
def run_api_scan(api_definition_path: str):
try:
print(f"Submitting API definition from {api_definition_path} for scanning...")
with open(api_definition_path, 'r') as f:
api_spec_content = f.read()
# Submit the API specification (e.g., OpenAPI/Swagger) for a new scan
# The `submit_api_definition` method initiates the scan process
scan_response = client.submit_api_definition(
project_id="your-project-id", # Replace with your Escape Project ID
api_definition=api_spec_content,
api_definition_format="openapi"
)
scan_id = scan_response.get("scan_id")
if not scan_id:
print("Failed to initiate scan.")
return
print(f"Scan initiated successfully. Scan ID: {scan_id}")
print("Waiting for scan to complete... This may take a few minutes.")
# Poll for scan results until complete
# In a real application, consider webhooks for asynchronous notifications
# or a more robust polling mechanism with backoff.
scan_status_response = {}
while scan_status_response.get("status") not in ["completed", "failed", "cancelled"]:
time.sleep(30) # Wait for 30 seconds before polling again
scan_status_response = client.get_scan_status(scan_id=scan_id)
print(f"Current scan status: {scan_status_response.get('status', 'unknown')}")
if scan_status_response.get("status") == "completed":
print("Scan completed. Fetching results.")
scan_results = client.get_scan_results(scan_id=scan_id)
print("Scan Results:")
# Process and display relevant parts of the scan results
for vulnerability in scan_results.get("vulnerabilities", []):
print(f" - Severity: {vulnerability.get('severity')}, Type: {vulnerability.get('type')}, Path: {vulnerability.get('path')}")
# Example: Retrieve summary statistics
print(f"Total vulnerabilities found: {len(scan_results.get('vulnerabilities', []))}")
print(f"Detailed report available at: {scan_results.get('report_url')}")
else:
print(f"Scan did not complete successfully. Final status: {scan_status_response.get('status')}")
print(f"Error details: {scan_status_response.get('error_message', 'N/A')}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
# Make sure 'openapi.yaml' exists in the same directory or provide full path
# You can also fetch this from a URL or generate it dynamically
api_definition_file = "openapi.yaml"
if not os.path.exists(api_definition_file):
print(f"Error: API definition file '{api_definition_file}' not found.")
print("Please create an openapi.yaml file or update the path.")
else:
run_api_scan(api_definition_file)
Before running this code:
- Replace
"your-project-id"with an actual project ID from your Escape account. - Ensure you have an
openapi.yamlfile in the same directory as your script, or modifyapi_definition_fileto point to your API definition. - Set the
ESCAPE_API_KEYenvironment variable with your Escape API key.
Community libraries
While Escape maintains official SDKs for Python, Go, Java, and Node.js, the broader developer community may contribute additional libraries or tools that extend Escape's functionality or provide alternative integrations. These community-driven projects can range from wrappers for less common programming languages to specialized utilities for specific CI/CD environments or reporting tools.
Community libraries are often hosted on platforms like GitHub and may be discovered through developer forums, blog posts, or by searching repositories. Unlike official SDKs, community contributions:
- May not be officially supported by Escape.
- Could have varying levels of documentation and maintenance.
- Might not always be up-to-date with the latest Escape API versions.
Developers considering using community libraries should evaluate their stability, security, and alignment with their project requirements. It is always advisable to review the source code and community activity before integrating such tools. For instance, open-source projects often follow Open Source Definition principles, which can provide insight into their governance and licensing.
To find potential community contributions, developers can search GitHub for repositories tagged with escape-api, escape-security, or similar keywords. The Escape community page or official forums (Escape Community) may also list notable community projects or provide avenues for collaboration and support.