A command-line tool for analyzing duplicate route signatures in Contrast Security applications.
Project description
contrast-route-duplicates
A command-line tool for analyzing duplicate route signatures in Contrast Security applications. This tool helps identify repeated route signatures across your application, which can be useful for identifying potential issues caused from merging duplicate applications.
Features
- Fast, asynchronous API querying with concurrent requests
- Progress tracking for large datasets
- CSV export for detailed analysis
- Summary statistics including duplicate counts and percentages
- Configurable batch size and concurrency
- Environment-based configuration
- Rich terminal output with color-coded results
Installation
- Install:
pip install contrast-route-duplicates
- Create a
.env
file with your Contrast Security credentials:
CONTRAST_BASE_URL=https://app.contrastsecurity.com/Contrast
CONTRAST_ORG_UUID=your-org-uuid
CONTRAST_API_KEY=your-api-key
CONTRAST_AUTH=your-auth-header
Usage
Basic usage:
contrast_route_duplicates APP_ID
With all options:
contrast_route_duplicates APP_ID \
--csv output.csv \
--batch-size 200 \
--concurrent-requests 20 \
--verbose
Options
APP_ID
: The Contrast Security application ID to analyze (required)--csv
: Output file path for detailed CSV results--batch-size
: Number of routes to fetch per request (default: 100)--concurrent-requests
: Maximum number of concurrent API requests (default: 10)--verbose
: Enable verbose logging
Output
The tool provides a summary of route signature analysis including:
- Total number of routes
- Number of unique signatures
- Number of signatures with duplicates
- Total number of duplicate routes
- Percentage of routes that are duplicates
Example output:
Starting analysis...
Fetching routes: 100% ██████████ 1615/1615
Route Analysis Summary
┌──────────────────────────┬────────────┐
│ Total routes │ 1,615 │
│ Unique signatures │ 602 │
│ Signatures with duplics │ 316 │
│ Total duplicate routes │ 708 │
│ Duplicate percentage │ 43.8% │
└──────────────────────────┴────────────┘
Detailed results have been written to: output.csv
CSV Output Format
The CSV output includes two columns:
Signature
: The route signatureCount
: Number of occurrences of that signature
Example:
Signature,Count
org.example.Controller.index(),3
org.example.UserService.getUser(),2
Environment Variables
Variable | Description | Example |
---|---|---|
CONTRAST_BASE_URL | Contrast Security API URL | https://app.contrastsecurity.com/Contrast |
CONTRAST_ORG_UUID | Organization UUID | 12345678-90ab-cdef-1234-567890abcdef |
CONTRAST_API_KEY | API Key | your-api-key |
CONTRAST_AUTH | Authorization header | base64-encoded-credentials |
Development
Requirements:
- Python 3.8+
- httpx
- typer
- rich
- python-dotenv
- tqdm
License
MIT License
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run the tests
- Submit a pull request
Support
For issues, questions, or contributions, please open an issue in the GitHub repository.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file contrast_route_duplicates-0.1.6.tar.gz
.
File metadata
- Download URL: contrast_route_duplicates-0.1.6.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3aa30d11aa419a6413daca5047230229e1690dcfb9d1aec39ebf1a5c39eddbd |
|
MD5 | 8476c613854ee4adc2adc784bbb0534e |
|
BLAKE2b-256 | 16406c9abb7309e57ef3335ff67b2970ff98c2415b7ac801ac935be69176cec9 |
File details
Details for the file contrast_route_duplicates-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: contrast_route_duplicates-0.1.6-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 525e3cf0ce3983827ea2d29c41243e7066431a68037743b2b10e75c08380dc2b |
|
MD5 | 0d76e35d4f683a64f04c5bb70ab538aa |
|
BLAKE2b-256 | 9c415d00c915386d87449a51c40fb595f587a5025d59741500388952b329ed9a |