This repository contains comprehensive tools for fetching vulnerability data from Cycode using their modern RIG GraphQL API and legacy report-based queries.
pip install -r requirements.txt
- Create
secret.yaml
with your Cycode credentials:
cycode:
client_id: "your-client-id"
client_secret: "your-client-secret"
# Get all open violations (default)
python3 fetch_violations.py
# Get specific violation types (open violations by default)
python3 fetch_violations.py --type SAST
python3 fetch_violations.py --type SCA
python3 fetch_violations.py --type IAC
python3 fetch_violations.py --type LICENSE
# Get violations by status
python3 fetch_violations.py --type SAST --status OPEN
python3 fetch_violations.py --type SAST --status ALL
python3 fetch_violations.py --type SAST --status DISMISSED
# Using RIG reports for bulk exports
python3 fetch_violations_rig.py -q rig_queries/sast_violations.json
fetch_violations.py
- Primary tool with comprehensive filtering- Types: ALL, SAST, IAC, SCA, LICENSE, SECRETS, CICD
- Status: OPEN (default), DISMISSED, RESOLVED, CLOSED, ALL
- Severity: Critical, High, Medium, Low, Info (comma-separated)
- Tiers: Filter by repository tier (tier1, tier2, tier3, other, all)
fetch_violations_rig.py
- Secondary tool using RIG report exports
assets/
- Supporting libraries and assetscycode_lib/
- Cycode API authentication and RIG functionsrig_queries/
- Pre-built RIG query templates for different violation types
cycode_policy_sync.py
- SAST policy management toolcomprehensive_test/
- Sample output datasast_policies.yaml
- SAST policy configurations
Best for: Real-time security monitoring and detailed analysis
β Advantages:
- Rich vulnerability metadata (EPSS scores, CVE advisories)
- Real-time data (38ms response time)
- Exploitability information
- Full dependency paths
- Future-proof (Cycode's preferred approach)
π Data Quality:
{
"vulnerability_id": "CVE-2024-12798",
"package_name": "ch.qos.logback:logback-core",
"severity": "Medium",
"epss_info": {"epss": 0.00174},
"advisory": {
"summary": "Expression Language Injection vulnerability",
"description": "Full CVE description..."
}
}
Best for: Bulk exports and compliance reporting
β Advantages:
- Large dataset exports (6,563 SAST violations)
- CSV format support
- Historical reporting capabilities
- Simple flat data structure
π Use Cases:
- Monthly compliance reports
- Historical trend analysis
- Executive dashboards
- Audit documentation
# Get all open violations (default behavior)
python3 fetch_violations.py --type ALL
# Get SAST violations only (open by default)
python3 fetch_violations.py --type SAST --output-dir sast_results
# Get SCA vulnerabilities with rich CVE data
python3 fetch_violations.py --type SCA --max-pages 5
# Get all SAST violations regardless of status
python3 fetch_violations.py --type SAST --status ALL
# Get dismissed violations for analysis
python3 fetch_violations.py --type SAST --status DISMISSED
# Get Infrastructure as Code violations
python3 fetch_violations.py --type IAC
# Get license violations (subset of SCA)
python3 fetch_violations.py --type LICENSE
# Get secrets detection violations
python3 fetch_violations.py --type SECRETS
# Get CI/CD security violations
python3 fetch_violations.py --type CICD
# π Severity filtering - Focus on critical issues only
python3 fetch_violations.py --type SAST --severity critical
# π Multiple severity levels - Critical and High
python3 fetch_violations.py --type SCA --severity critical,high
# π·οΈ Tier filtering - Show only non-tiered repositories
python3 fetch_violations.py --type ALL --per-tier other
# π·οΈ Specific tier filtering - Show only tier1 and tier2
python3 fetch_violations.py --type SAST --per-tier tier1,tier2
# π·οΈ All tiers with detailed breakdown
python3 fetch_violations.py --type SCA --per-tier all
# π Advanced combinations
python3 fetch_violations.py --type ALL --severity critical --per-tier other
python3 fetch_violations.py --type SECRETS --severity high,medium --per-repo
python3 fetch_violations.py --type CICD --status ALL --per-tier tier1,tier2
# Export SAST violations to JSON
python3 fetch_violations_rig.py -q assets/rig_queries/sast_violations.json -o sast_report.json
# Export to CSV for spreadsheets
python3 fetch_violations_rig.py -q assets/rig_queries/all_violations.json -o compliance_report.csv -f CSV
# Get secrets detection data
python3 fetch_violations_rig.py -q assets/rig_queries/secrets_violations.json -o secrets_report.json
assets/rig_queries/sast_violations.json
- SAST (Static Analysis) violations onlyassets/rig_queries/secrets_violations.json
- Secrets detection violations onlyassets/rig_queries/all_violations.json
- All violation types (SAST + SCA + Secrets)
The --per-tier
flag allows you to filter repositories by their tier classification:
- TIER1, TIER2, TIER3: Repositories with explicit tier tags/labels
- OTHER: Repositories without explicit tier classification
# Find all non-tiered repositories (identify unclassified repos)
python3 fetch_violations.py --per-tier other
# Focus on production tiers only
python3 fetch_violations.py --per-tier tier1,tier2
# Complete analysis of all tiers
python3 fetch_violations.py --per-tier all
# Critical issues in non-tiered repositories
python3 fetch_violations.py --severity critical --per-tier other
- π― Targeted Analysis: Focus on specific repository groups
- π Repository Classification: Identify repos needing tier assignment
- π Risk Assessment: Prioritize by tier importance
- π Governance: Track tier-specific security metrics
Use fetch_violations.py
for:
- Daily security monitoring
- Detailed vulnerability analysis
- Risk assessment with EPSS scoring
- Real-time security dashboards
Use fetch_violations_rig.py
for:
- Compliance reporting
- Historical analysis
- Bulk data exports
- CSV format requirements
π’ Total Unique Vulnerabilities: 201
π― Total Detection Instances: 201
β οΈ By Severity:
Critical: 19
High: 101
Medium: 69
Low: 12
π¦ By Ecosystem:
Maven: 113
NPM: 35
PyPI: 45
Composer: 8
π― Exploitability Analysis:
High Risk (>0.1 EPSS): 48
Medium Risk (0.01-0.1): 25
Low Risk (<0.01): 128
- Keep
secret.yaml
secure and never commit to version control - Credentials are automatically loaded from environment or config file
- All API calls use proper authentication headers
Both approaches are fully functional and complementary. Choose based on your specific use case:
- Real-time analysis β Direct GraphQL
- Bulk reporting β RIG Reports
This implementation successfully integrates with Cycode's RIG (Risk Information Graph) system using both modern GraphQL endpoints and legacy report-based queries.