Files
Kill_LIFE/tools/security/generate_security_badge.py
Clément SAILLANT 124906d084 feat: Add comprehensive CI/CD workflows and badges for compliance, security, and quality assurance
- Introduced multiple guides for workflows including Evidence Pack Validation, Incident Response, Model Validation, Performance & HIL, Release Signing, SBOM Validation, Secret Scanning, and Supply Chain Attestation.
- Created dynamic badges for each workflow to reflect their status and compliance.
- Implemented a checklist for validating CI/CD workflows and evidence packs.
- Developed scripts for building firmware, testing, collecting evidence, and generating audit reports.
- Added tools for generating community, documentation, quality, and security badges based on various reports.
- Established endpoints for dynamic badges to be integrated into documentation and README files.
- Enhanced the overall structure and traceability of CI/CD processes with evidence packs and automated checks.
2026-02-19 08:58:10 +01:00

59 lines
1.6 KiB
Python

#!/usr/bin/env python3
# Script de génération du badge sécurité pour Kill_LIFE
# Analyse les rapports Snyk, CodeQL, Trivy et génère un summary JSON pour shields.io
import json
import os
from datetime import datetime
# Chemins des rapports (exemples)
SNYK_REPORT = 'docs/security/snyk_report.json'
CODEQL_REPORT = 'docs/security/codeql_report.json'
TRIVY_REPORT = 'docs/security/trivy_report.json'
OUTPUT = 'docs/security-summary.json'
status = 'success'
issues = []
# Fonction pour charger un rapport JSON
def load_report(path):
if not os.path.exists(path):
return None
with open(path, 'r') as f:
return json.load(f)
# Analyse Snyk
snyk = load_report(SNYK_REPORT)
if snyk and snyk.get('issues', []):
status = 'fail'
issues += snyk['issues']
# Analyse CodeQL
codeql = load_report(CODEQL_REPORT)
if codeql and codeql.get('alerts', []):
status = 'fail'
issues += codeql['alerts']
# Analyse Trivy
trivy = load_report(TRIVY_REPORT)
if trivy and trivy.get('results', []):
for result in trivy['results']:
if result.get('Vulnerabilities'):
status = 'fail'
issues += result['Vulnerabilities']
# Génération du summary pour shields.io
badge = {
"schemaVersion": 1,
"label": "Security Scan",
"message": "OK" if status == 'success' else f"{len(issues)} vuln",
"color": "green" if status == 'success' else "red",
"timestamp": datetime.utcnow().isoformat() + 'Z',
"details": issues
}
with open(OUTPUT, 'w') as f:
json.dump(badge, f, indent=2)
print(f"Badge sécurité généré : {OUTPUT} (status: {badge['message']})")