SDKs overview
Bugcrowd offers various software development kits (SDKs) and libraries designed to help developers and security teams integrate their Bugcrowd programs with other tools and workflows. These resources typically wrap the underlying Bugcrowd API, providing language-specific interfaces for common operations. The primary goal of these SDKs is to streamline tasks such as submitting vulnerabilities, managing program scope, retrieving vulnerability data, and automating interactions with the Bugcrowd platform. While official SDKs are maintained directly by Bugcrowd, a vibrant community also contributes libraries that extend functionality or support additional programming languages.
Access to the Bugcrowd API, which these SDKs interact with, is typically granted through client support or account management, ensuring that API usage aligns with specific program requirements and security policies. The API documentation provides comprehensive details on available endpoints and authentication methods, which are foundational for using any SDK or library effectively. Developers can review the Bugcrowd API v3 documentation for specific endpoint details.
The use of SDKs can reduce the boilerplate code required for API interaction, handling authentication, request formatting, and response parsing. This allows developers to focus on integrating Bugcrowd's security capabilities into their applications and CI/CD pipelines more efficiently. For example, an SDK might simplify the process of programmatically creating a new submission or fetching the status of existing vulnerabilities, which are common automation tasks in a continuous security model. Integrating security checks into development pipelines is a recognized practice for improving software quality, as described in Google Cloud's DevSecOps guide.
Official SDKs by language
Bugcrowd maintains official SDKs for specific programming languages, providing tested and supported interfaces for interacting with its platform. These SDKs are developed to ensure compatibility with the latest API versions and to offer a consistent developer experience. The official SDKs typically cover core functionalities such as managing submissions, interacting with targets, and retrieving program data. Bugcrowd's official documentation details the available SDKs and their capabilities, often including examples for common use cases. Developers are encouraged to consult the Bugcrowd API documentation for the most up-to-date information on official SDKs and their supported features.
Here is a summary of official SDKs and their characteristics:
| Language | Package/Repository | Maturity | Description |
|---|---|---|---|
| Python | bugcrowd-client |
Stable | Official Python client for interacting with the Bugcrowd API. Supports program management, submission handling, and data retrieval. |
| Ruby | bugcrowd-ruby |
Stable | Official Ruby client library. Facilitates integration of Bugcrowd platform features into Ruby applications. |
These official SDKs are designed to be robust and are regularly updated to reflect changes and improvements in the Bugcrowd API. They often include features such as automatic retry mechanisms, error handling, and object serialization/deserialization, which simplify the development process. For instance, the Python SDK would abstract away the HTTP requests and JSON parsing, allowing a developer to work with Python objects directly when managing submissions or targets.
Installation
Installation of Bugcrowd's official SDKs follows standard practices for each respective programming language's package management system. Prior to installation, ensure that your environment meets any specified prerequisites, such as minimum language versions. Authentication credentials, typically an API key and secret, will be required to initialize the SDK and interact with the Bugcrowd API. These credentials should be stored securely and not hardcoded directly into application source code. Environment variables or a secure configuration management system are recommended for handling sensitive information, as detailed in Microsoft's data protection best practices.
Python SDK Installation
To install the official Python SDK, use pip, the Python package installer:
pip install bugcrowd-client
After installation, you can import the client and configure it with your API credentials. It is crucial to obtain your API key and secret from your Bugcrowd account or by contacting Bugcrowd support, as these are necessary for authenticated API calls.
Ruby SDK Installation
For the official Ruby SDK, add it to your project's Gemfile and run bundle install:
# Gemfile
gem 'bugcrowd-ruby'
bundle install
Once installed, the Ruby client can be initialized with your Bugcrowd API credentials, allowing programmatic access to your programs and data.
Quickstart example
This quickstart example demonstrates how to use the Bugcrowd Python SDK to retrieve a list of submissions from your Bugcrowd program. This assumes you have already installed the bugcrowd-client package and have your API key and secret readily available, preferably stored as environment variables for security.
First, ensure your API credentials are set as environment variables:
export BUGCROWD_API_KEY="your_api_key_here"
export BUGCROWD_API_SECRET="your_api_secret_here"
Then, create a Python script (e.g., get_submissions.py) with the following content:
import os
from bugcrowd.client import BugcrowdClient
# Retrieve API credentials from environment variables
api_key = os.getenv('BUGCROWD_API_KEY')
api_secret = os.getenv('BUGCROWD_API_SECRET')
if not api_key or not api_secret:
print("Error: BUGCROWD_API_KEY and BUGCROWD_API_SECRET environment variables must be set.")
exit(1)
try:
# Initialize the Bugcrowd client
client = BugcrowdClient(api_key=api_key, api_secret=api_secret)
# Fetch all submissions (or apply filters as needed)
# The 'submissions' method returns an iterable object.
print("Fetching submissions...")
submissions = client.submissions.list()
# Print details for the first 5 submissions (or iterate through all)
count = 0
for submission in submissions:
print(f"Submission ID: {submission.id}")
print(f" Title: {submission.title}")
print(f" State: {submission.state}")
print(f" Severity: {submission.severity}")
print(f" Program: {submission.program.name}")
print("----------------------------------")
count += 1
if count >= 5:
break # Limit output for quickstart
if count == 0:
print("No submissions found or displayed.")
except Exception as e:
print(f"An error occurred: {e}")
Execute the script:
python get_submissions.py
This script initializes the Bugcrowd client using credentials from environment variables, then fetches and prints basic details for the first five submissions found in your Bugcrowd programs. This demonstrates a fundamental interaction, and the SDK provides methods for more complex operations, such as creating new submissions, updating existing ones, or managing targets.
Community libraries
Beyond the official SDKs, the Bugcrowd developer community has contributed various libraries and tools that extend integration possibilities. These community-driven projects often address specific use cases, support additional programming languages, or provide command-line interfaces (CLIs) for quick interactions. While not officially supported by Bugcrowd, these libraries can offer valuable flexibility and demonstrate diverse approaches to interacting with the Bugcrowd API.
Community libraries can be found on platforms like GitHub or package repositories specific to programming languages (e.g., PyPI for Python, RubyGems for Ruby). When considering a community library, it is advisable to review its documentation, check its activity level, and assess its compatibility with the current Bugcrowd API version. Due diligence is recommended to ensure the library is well-maintained and secure before incorporating it into production workflows. Developers often contribute to open-source projects to fill gaps or enhance functionality, as discussed in the Mozilla Developer Network's open-source definition.
Examples of potential community contributions might include:
- Go client library: A library written in Go to interact with the Bugcrowd API, allowing Go developers to integrate Bugcrowd services into their applications.
- Node.js wrapper: A JavaScript/TypeScript wrapper for the Bugcrowd API, enabling server-side Node.js applications to manage security programs.
- CLI tools: Command-line interfaces built on top of the API, providing quick access to common Bugcrowd operations without writing full scripts.
- Integrations with specific platforms: Libraries designed to bridge Bugcrowd data with project management tools (e.g., Jira, Notion), CI/CD pipelines, or other security orchestration platforms.
To discover community libraries, developers can search GitHub for repositories tagged with "bugcrowd" or explore relevant package managers. Always verify the source and maintainer of any third-party library before integrating it into your projects, especially when dealing with security-sensitive data and operations.