# Export Flow ## Overview The Export Flow describes how StellaOps generates and delivers reports, evidence bundles, and compliance documentation. Exports can be triggered on-demand or scheduled, and support multiple formats including PDF, Excel, JSON, and SARIF. **Business Value**: Automated, auditable exports reduce manual effort for compliance reporting and enable integration with external systems. ## Actors | Actor | Type | Role | |-------|------|------| | User | Human | Requests or schedules exports | | Console | System | UI for export configuration | | Gateway | Service | Routes export requests | | ExportCenter | Service | Orchestrates export generation | | Scanner | Service | Provides scan data | | Policy | Service | Provides policy verdicts | | EvidenceLocker | Service | Stores sealed evidence | | RustFS | Storage | Stores export artifacts | ## Prerequisites - User has export permissions for the resource - Data exists for the requested export scope - Export template configured (for custom formats) ## Supported Export Formats | Format | Extension | Use Case | |--------|-----------|----------| | PDF | `.pdf` | Human-readable reports | | Excel | `.xlsx` | Data analysis, spreadsheet import | | JSON | `.json` | API integration, automation | | SARIF | `.sarif` | IDE integration, GitHub Code Scanning | | CycloneDX | `.cdx.json` | SBOM exchange | | SPDX | `.spdx.json` | SBOM compliance | | CSV | `.csv` | Data export, legacy systems | ## Flow Diagram ``` ┌─────────────────────────────────────────────────────────────────────────────────┐ │ Export Flow │ └─────────────────────────────────────────────────────────────────────────────────┘ ┌────────┐ ┌─────────┐ ┌─────────┐ ┌────────────┐ ┌──────────────┐ ┌────────┐ │ User │ │ Console │ │ Gateway │ │ExportCenter│ │EvidenceLocker│ │ RustFS │ └───┬────┘ └────┬────┘ └────┬────┘ └─────┬──────┘ └──────┬───────┘ └───┬────┘ │ │ │ │ │ │ │ Request │ │ │ │ │ │ export │ │ │ │ │ │───────────>│ │ │ │ │ │ │ │ │ │ │ │ │ POST │ │ │ │ │ │ /exports │ │ │ │ │ │───────────>│ │ │ │ │ │ │ │ │ │ │ │ │ Forward │ │ │ │ │ │────────────>│ │ │ │ │ │ │ │ │ │ │ 202 │ │ │ │ │ │ Accepted │ │ │ │ │ │<───────────│ │ │ │ │ │ │ │ │ │ │ Export │ │ │ │ │ │ queued │ │ │ │ │ │<───────────│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ Query scan │ │ │ │ │ │ data │ │ │ │ │ │───┐ │ │ │ │ │ │ │ │ │ │ │ │ │<──┘ │ │ │ │ │ │ │ │ │ │ │ │ Query policy │ │ │ │ │ │ verdicts │ │ │ │ │ │───┐ │ │ │ │ │ │ │ │ │ │ │ │ │<──┘ │ │ │ │ │ │ │ │ │ │ │ │ Render │ │ │ │ │ │ template │ │ │ │ │ │───┐ │ │ │ │ │ │ │ │ │ │ │ │ │<──┘ │ │ │ │ │ │ │ │ │ │ │ │ Store artifact │ │ │ │ │ │────────────────────────────────> │ │ │ │ │ │ │ │ │ │ {path} │ │ │ │ │ │<──────────────────────────────── │ │ │ │ │ │ │ │ │ │ Seal evidence │ │ │ │ │ │───────────────>│ │ │ │ │ │ │ │ │ │ │ │ Sealed bundle │ │ │ │ │ │<───────────────│ │ │ │ │ │ │ │ │ │ │ │ Store sealed │ │ │ │ │ │────────────────────────────────> │ │ │ │ │ │ │ WebSocket: │ │ │ │ │ │ export │ │ │ │ │ │ ready │ │ │ │ │ │<───────────│ │ │ │ │ │ │ │ │ │ │ ``` ## Step-by-Step ### 1. Export Request User requests export via Console or API: ```http POST /api/v1/exports HTTP/1.1 Authorization: Bearer {jwt} X-Tenant-Id: acme-corp Content-Type: application/json { "type": "scan_report", "format": "pdf", "scope": { "scan_ids": ["scan-7f3a9b2c-..."], "date_range": null }, "options": { "include_sbom": true, "include_evidence": true, "template": "compliance-executive" } } ``` ### 2. Export Job Creation ExportCenter creates export job: ```json { "export_id": "exp-456def", "status": "queued", "type": "scan_report", "format": "pdf", "created_at": "2024-12-29T10:30:00Z", "estimated_completion": "PT2M" } ``` ### 3. Data Gathering ExportCenter queries multiple data sources: | Source | Query | Data | |--------|-------|------| | Scanner | `GET /internal/scans/{id}` | Scan results, findings | | Policy | `GET /internal/verdicts/{scan_id}` | Policy verdicts | | VexLens | `GET /internal/vex/applied/{scan_id}` | VEX statements | | SbomService | `GET /internal/sboms/{digest}` | SBOM document | ### 4. Template Rendering ExportCenter applies report template: ``` Templates Available: ├── compliance-executive # High-level summary for executives ├── compliance-detailed # Full findings with remediation ├── audit-evidence # Audit trail with attestations ├── developer-sarif # IDE-compatible SARIF output └── custom-{tenant} # Tenant-specific templates ``` PDF generation uses Chromium for high-fidelity rendering: ```typescript const pdf = await chromium.pdf({ content: renderedHtml, format: 'A4', margin: { top: '1cm', bottom: '1cm' }, displayHeaderFooter: true, headerTemplate: '