Veracode Platform Client Library
A comprehensive Rust client library for the Veracode security platform, providing type-safe and ergonomic access to Applications, Identity, Pipeline Scan, Sandbox, Policy, and Build APIs.
โจ Features
- ๐ HMAC Authentication - Built-in Veracode API credential support with automatic signature generation
- ๐ก๏ธ Secure Credential Handling - All API credentials are securely wrapped to prevent accidental exposure in logs
- ๐ Multi-Regional Support - Automatic endpoint routing for Commercial, European, and Federal regions
- ๐ Smart API Routing - Automatically uses REST or XML APIs based on operation requirements
- ๐ฑ Applications API - Complete application lifecycle management via REST API
- ๐ฅ Identity API - User and team management via REST API
- ๐ Pipeline Scan API - CI/CD security scanning via REST API
- ๐งช Sandbox API - Development sandbox management via REST API
- ๐จ Build API - Build management and SAST operations via XML API
- ๐ Scan API - File upload and scan operations via XML API
- ๐ Policy API - Security policy management and compliance evaluation via REST API
- ๐ Async/Await - Built on tokio for high-performance concurrent operations
- โก Type-Safe - Full Rust type safety with comprehensive serde serialization
- ๐ Rich Data Types - Comprehensive data structures for all API responses
- ๐ง Workflow Helpers - High-level operations combining multiple API calls
- ๐ Debug Safety - All sensitive credentials show
[REDACTED]in debug output - ๐งช Comprehensive Testing - Extensive test coverage including security measures
๐ Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
= { = "1.0", = ["full"] }
Basic Usage
use ;
async
๐ Regional Support
The library automatically handles regional endpoints for both REST and XML APIs:
use ;
// Commercial region (default)
let config = new
.with_region;
// REST: api.veracode.com | XML: analysiscenter.veracode.com
// European region
let config = new
.with_region;
// REST: api.veracode.eu | XML: analysiscenter.veracode.eu
// US Federal region
let config = new
.with_region;
// REST: api.veracode.us | XML: analysiscenter.veracode.us
๐ API Modules
Applications API (REST)
Complete application lifecycle management:
// List all applications
let apps = client.get_all_applications.await?;
// Get specific application
let app_query = ApplicationQuery ;
let app = client.get_application.await?;
// Create new application
let create_request = CreateApplicationRequest ;
let new_app = client.create_application.await?;
Pipeline Scan API (REST)
CI/CD security scanning:
use ;
let pipeline = client.pipeline_api;
// Create a pipeline scan
let scan_request = CreateScanRequest ;
let scan_result = pipeline.create_scan.await?;
println!;
// Monitor scan status
let scan_info = pipeline.get_scan.await?;
println!;
// Get findings when complete
if scan_info.status == Complete
Identity API (REST)
User and team management:
let identity = client.identity_api;
// List users
let users = identity.get_users.await?;
// Create new user
let create_user = CreateUserRequest ;
let new_user = identity.create_user.await?;
// Manage teams
let teams = identity.get_teams.await?;
Sandbox API (REST)
Development sandbox management:
let sandbox_api = client.sandbox_api;
// List sandboxes for an application
let sandboxes = sandbox_api.get_sandboxes.await?;
// Create new sandbox
let create_request = CreateSandboxRequest ;
let sandbox = sandbox_api.create_sandbox.await?;
Scan API (XML)
File upload and scan operations:
let scan_api = client.scan_api;
// Upload file for scanning
let upload_request = UploadFileRequest ;
let uploaded_file = scan_api.upload_file.await?;
println!;
// Start pre-scan
let pre_scan = scan_api.begin_pre_scan;
Policy API (REST)
Security policy and compliance management:
let policy_api = client.policy_api;
// Get organizational policies
let policies = policy_api.get_policies.await?;
// Evaluate policy compliance
let compliance = policy_api.evaluate_policy_compliance.await?;
println!;
println!;
// Initiate policy-based scan
let scan_request = PolicyScanRequest ;
let scan_result = policy_api.initiate_policy_scan.await?;
Build API (XML)
Build management and SAST operations:
let build_api = client.build_api;
// Get build list for application
let builds = build_api.get_build_list.await?;
// Create new build
let create_build = CreateBuildRequest ;
let build = build_api.create_build.await?;
Workflow Helpers
High-level operations combining multiple API calls:
let workflow = client.workflow;
// Complete application workflow
let workflow_config = WorkflowConfig ;
let result = workflow.run_complete_workflow.await?;
println!;
๐ Authentication
Environment Variables
Set your Veracode API credentials:
Direct Configuration
Or pass credentials directly:
let config = new;
Development Mode
Disable certificate validation for development environments:
Or in code:
let config = new
.with_certificate_validation_disabled; // Only for development!
๐๏ธ Feature Flags
Enable only the APIs you need to reduce compile time and binary size:
[]
= { = "0.1.0", = ["pipeline", "applications"] }
Available features:
applications- Applications API supportidentity- Identity API supportpipeline- Pipeline Scan API supportsandbox- Sandbox API supportpolicy- Policy API supportdefault- All APIs enabled
๐งช Examples
The library includes comprehensive examples for each API:
# Set up credentials first
# Applications API example
# Identity API example
# Pipeline Scan API example
# Sandbox API example
# Policy API example
# Basic usage example
# Build lifecycle example
# Large file upload example
# XML API workflow validation
๐๏ธ Architecture
API Type Routing
The library automatically routes operations to the correct API type:
- REST API (
api.veracode.*): Applications, Identity, Pipeline, Policy, Sandbox management - XML API (
analysiscenter.veracode.*): Build management, Scan operations, Legacy workflows
Smart Client Management
The client automatically creates specialized instances for different API types:
let client = new?;
// REST API modules use the main client
let apps = client.get_all_applications.await?; // Uses REST
let pipeline = client.pipeline_api; // Uses REST
let identity = client.identity_api; // Uses REST
// XML API modules use a specialized XML client internally
let scan_api = client.scan_api; // Uses XML
let build_api = client.build_api; // Uses XML
Regional Endpoint Management
All regional variants are supported with automatic endpoint resolution:
| Region | REST Endpoint | XML Endpoint |
|---|---|---|
| Commercial | api.veracode.com |
analysiscenter.veracode.com |
| European | api.veracode.eu |
analysiscenter.veracode.eu |
| Federal | api.veracode.us |
analysiscenter.veracode.us |
๐ Security Features
Secure Credential Handling
All API credentials are automatically secured to prevent accidental exposure:
use ;
// Credentials are automatically wrapped in secure containers
let config = new;
// Debug output shows [REDACTED] instead of actual credentials
println!;
// Output: VeracodeConfig { api_id: [REDACTED], api_key: [REDACTED], ... }
Debug Safety
All sensitive information is automatically redacted in debug output:
- API Credentials:
VERACODE_API_IDandVERACODE_API_KEYshow as[REDACTED] - Configuration Structures:
VeracodeConfigsafely displays structure without exposing credentials - Identity API:
ApiCredentialstructures redact sensitiveapi_keyfields - Comprehensive Coverage: All credential-containing structures are protected
Backward Compatibility
Security improvements are transparent to existing code:
- All existing examples continue to work unchanged
- No breaking changes to public APIs
- Secure wrappers are internal implementation details
- Access to credentials through standard methods (
as_str(),into_string())
๐ง Error Handling
The library provides comprehensive error types for robust error handling:
use ;
// Pipeline API error handling
match pipeline.get_findings.await
// Sandbox API error handling
match sandbox_api.get_sandboxes.await
Common Error Types
| Error Type | Description |
|---|---|
VeracodeError::Authentication |
Invalid API credentials or signature issues |
VeracodeError::NotFound |
Requested resource doesn't exist |
VeracodeError::InvalidResponse |
API returned unexpected response format |
VeracodeError::Http |
Network or HTTP-level errors |
VeracodeError::Serialization |
JSON parsing or serialization errors |
๐ Data Types
Core Types
// Application management
// Pipeline scanning
// Identity management
Enums and Status Types
// Scan status tracking
// Security severity levels
// Development stages
๐ฌ Testing
Run the test suite:
# Run all tests
# Run tests with output
# Run specific test module
Note: Integration tests require valid Veracode API credentials and may create/modify resources in your Veracode account.
๐ Documentation
Generate and view the documentation:
# Build and open documentation
# Build documentation for all features
๐ท๏ธ Versioning
This library follows Semantic Versioning:
- Major version changes indicate breaking API changes
- Minor version changes add functionality in a backward-compatible manner
- Patch version changes include backward-compatible bug fixes
๐ค Contributing
Contributions are welcome! Please read our contributing guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
# Clone the repository
# Run tests
# Check formatting
# Run lints
# Build documentation
๐ License
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
๐ Support
- ๐ Documentation: docs.rs/veracode-platform
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ Changelog: CHANGELOG.md
Built with โค๏ธ in Rust for the security community