feat(sbom): Add CRA Annex I compliant SBOM pipeline

Implements comprehensive Software Bill of Materials generation for
EU Cyber Resilience Act compliance with ANSSI CSPN certification path.

SBOM Pipeline:
- scripts/check-sbom-prereqs.sh: Prerequisites validation (OpenWrt, tools, Kconfig)
- scripts/sbom-generate.sh: Multi-source SBOM generation (native, feed, rootfs, firmware)
- scripts/sbom-audit-feed.sh: PKG_HASH/PKG_LICENSE feed audit with MANIFEST.md
- Makefile: SBOM targets (sbom, sbom-quick, sbom-validate, sbom-scan, sbom-audit)
- .github/workflows/sbom-release.yml: CI with CVE gating and auto-security issues

Documentation:
- SECURITY.md: CRA Art. 13 §6 compliant vulnerability disclosure policy
- docs/sbom-pipeline.md: Architecture, CRA mapping, ANSSI CSPN guidance

AI Gateway (bonus feed):
- secubox-ai-gateway: 3-tier data classification (LOCAL_ONLY/SANITIZED/CLOUD_DIRECT)
- luci-app-ai-gateway: LuCI dashboard with provider management and audit logging

Output formats: CycloneDX 1.6 (primary) + SPDX 2.3 (secondary)
Tools: syft, grype, cyclonedx-cli (auto-installed if missing)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-03-04 08:01:00 +01:00
parent 684673d714
commit 8769a60275
154 changed files with 2352 additions and 253 deletions

View File

@ -4331,3 +4331,54 @@ git checkout HEAD -- index.html
Nextcloud, Webmail, Jellyfin, Gitea, Matrix, PeerTube, Streamlit portal, Metablogizer sites
- HAProxy backend health checks verified (`check` option on all servers)
- External access requires upstream router port forwarding (82.67.100.75 → 192.168.255.1)
71. **AI Gateway Implementation (2026-03-04)**
- **Data Classification Engine:**
- 3-tier classification: `LOCAL_ONLY`, `SANITIZED`, `CLOUD_DIRECT`
- Pattern detection: IPv4/IPv6, MAC addresses, private keys, credentials
- Security tool references (crowdsec, iptables, nftables) auto-classified
- **PII Sanitizer:**
- IP anonymization (192.168.1.100 → 192.168.1.XXX)
- Credential scrubbing (password=secret → password=[REDACTED])
- **Provider Routing:**
- LocalAI (priority 0, always enabled, local_only)
- Mistral EU (priority 1, opt-in, sanitized)
- Claude/OpenAI/Gemini/xAI (priority 2+, opt-in, cloud_direct)
- **Package:** `secubox-ai-gateway` with `aigatewayctl` CLI
- **RPCD Backend:** 11 methods for LuCI integration
- **LuCI Frontend:** `luci-app-ai-gateway` with 4 views (Overview, Providers, Classify, Audit)
- **Audit Logging:** ANSSI CSPN compliant JSON logs with timestamps
72. **SBOM Pipeline for CRA Annex I Compliance (2026-03-04)**
- **Prerequisites Check (`scripts/check-sbom-prereqs.sh`):**
- OpenWrt version validation (>= 22.03)
- Auto-detect SDK location if not in buildroot
- package-metadata.pl CycloneDX support check
- Host tools: jq, sha256sum, git, perl
- Optional tools: syft, grype, cyclonedx-cli (auto-install)
- Kconfig: CONFIG_JSON_CYCLONEDX_SBOM setting
- **SBOM Generator (`scripts/sbom-generate.sh`):**
- 4 sources: OpenWrt native, SecuBox feed Makefiles, rootfs scan, firmware image
- CycloneDX 1.6 primary output
- SPDX 2.3 secondary output
- SOURCE_DATE_EPOCH for reproducibility
- Component merge and deduplication
- **Feed Auditor (`scripts/sbom-audit-feed.sh`):**
- PKG_HASH and PKG_LICENSE validation
- MANIFEST.md generation
- Suggested PKG_HASH from dl/ tarballs
- **Makefile Targets:**
- `make sbom` - Full generation
- `make sbom-quick` - No rebuild
- `make sbom-validate` - CycloneDX validation
- `make sbom-scan` - Grype CVE scan
- `make sbom-audit` - Feed audit
- `make sbom-prereqs` - Check prerequisites
- **GitHub Actions (`.github/workflows/sbom-release.yml`):**
- Trigger: tags, workflow_dispatch, weekly schedule (CVE scan)
- Jobs: sbom-generate, sbom-publish, sbom-cve-gate
- Auto-create security issues for critical CVEs
- **Documentation:**
- `docs/sbom-pipeline.md` - Architecture, usage, CRA mapping
- `SECURITY.md` - CRA Art. 13 §6 compliant disclosure policy
- VEX policy reference

View File

@ -1,6 +1,6 @@
# Work In Progress (Claude)
_Last updated: 2026-03-03 (Comprehensive Service Audit)_
_Last updated: 2026-03-04 (SBOM Pipeline + AI Gateway)_
> **Architecture Reference**: SecuBox Fanzine v3 — Les 4 Couches
@ -8,6 +8,32 @@ _Last updated: 2026-03-03 (Comprehensive Service Audit)_
## Couche 1 — Core Mesh
### Just Completed (2026-03-04)
- **SBOM Pipeline for CRA Annex I Compliance** — DONE (2026-03-04)
- `scripts/check-sbom-prereqs.sh` - Prerequisites validation (OpenWrt version, tools, Kconfig)
- `scripts/sbom-generate.sh` - Multi-source SBOM generation (OpenWrt, feed, rootfs, firmware)
- `scripts/sbom-audit-feed.sh` - PKG_HASH/PKG_LICENSE feed audit with MANIFEST.md output
- `Makefile` - SBOM targets (sbom, sbom-quick, sbom-validate, sbom-scan, sbom-audit, sbom-prereqs)
- `.github/workflows/sbom-release.yml` - GitHub Actions with CVE gating and auto-security issues
- `docs/sbom-pipeline.md` - Full documentation with CRA mapping and ANSSI CSPN guidance
- `SECURITY.md` - CRA Art. 13 §6 compliant vulnerability disclosure policy
- **AI Gateway Full-Stack Implementation** — DONE (2026-03-04)
- **Backend** (`secubox-ai-gateway`):
- 3-tier data classification: LOCAL_ONLY, SANITIZED, CLOUD_DIRECT
- PII sanitizer: IP anonymization, credential scrubbing
- Provider routing: LocalAI > Mistral EU > Claude > OpenAI > Gemini > xAI
- `aigatewayctl` CLI with classify/sanitize/provider/audit commands
- RPCD backend with 11 ubus methods
- ANSSI CSPN compliant audit logging
- **Frontend** (`luci-app-ai-gateway`):
- 4 KISS-themed views: Overview, Providers, Classify, Audit
- Provider management with API key storage
- Interactive classification testing
- Audit log viewer with distribution charts
- Deployed and tested on router (classification + sanitization working)
### Recently Completed (2026-02-04/05)
- **MAC Guardian Feed Integration** — DONE (2026-02-05)

View File

@ -506,7 +506,12 @@
"Bash(# Test registration again echo \"\"=== Registration Flows ===\"\" curl -s -X POST \"\"https://matrix.gk2.secubox.in/_matrix/client/v3/register\"\" \\\\ -H \"\"Content-Type: application/json\"\" \\\\ -d ''{}'')",
"Bash(# Test registration now echo \"\"=== Registration Flows ===\"\" curl -s -X POST \"\"https://matrix.gk2.secubox.in/_matrix/client/v3/register\"\" \\\\ -H \"\"Content-Type: application/json\"\" \\\\ -d ''{}'')",
"Bash(# Final registration test curl -s -X POST \"\"https://matrix.gk2.secubox.in/_matrix/client/v3/register\"\" \\\\ -H \"\"Content-Type: application/json\"\" \\\\ -d ''{}'')",
"WebFetch(domain:pf.gk2.secubox.in)"
"WebFetch(domain:pf.gk2.secubox.in)",
"Bash(__NEW_LINE_4f688fa65b287613__ echo \"\")",
"WebFetch(domain:enhance-app.gk2.secubox.in)",
"Bash(openssl dgst:*)",
"Bash(# Check the exact field names returned by stats ssh root@192.168.255.1 \"\"ubus call luci.cdn-cache stats\"\")",
"Bash(arping:*)"
]
}
}

261
.github/workflows/sbom-release.yml vendored Normal file
View File

@ -0,0 +1,261 @@
name: SBOM Release Pipeline
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to generate SBOM for (e.g., 0.20)'
required: true
type: string
schedule:
# Weekly CVE scan on Monday 2 AM UTC
- cron: '0 2 * * 1'
env:
ARCH: aarch64_cortex-a53
SBOM_DIR: dist/sbom
jobs:
sbom-generate:
name: Generate SBOM
runs-on: ubuntu-24.04
timeout-minutes: 30
outputs:
version: ${{ steps.version.outputs.version }}
sbom_path: ${{ steps.generate.outputs.sbom_path }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for git describe
- name: Determine version
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ inputs.version }}"
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}" # Strip 'v' prefix
else
VERSION=$(cat version 2>/dev/null || git describe --tags --always)
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Cache OpenWrt toolchain
uses: actions/cache@v4
with:
path: |
~/.cache/openwrt-toolchain
staging_dir
build_dir
key: openwrt-toolchain-${{ env.ARCH }}-${{ hashFiles('feeds.conf', '.config') }}
restore-keys: |
openwrt-toolchain-${{ env.ARCH }}-
- name: Cache SBOM tools
uses: actions/cache@v4
with:
path: |
~/.local/bin/syft
~/.local/bin/grype
~/.local/bin/cyclonedx-cli
~/.cache/grype
~/.cache/syft
key: sbom-tools-v1
restore-keys: |
sbom-tools-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Install SBOM tools
run: |
mkdir -p ~/.local/bin
export PATH="$HOME/.local/bin:$PATH"
# Install syft
if [[ ! -x ~/.local/bin/syft ]]; then
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b ~/.local/bin
fi
syft version
# Install grype
if [[ ! -x ~/.local/bin/grype ]]; then
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b ~/.local/bin
fi
grype version
# Install cyclonedx-cli
if [[ ! -x ~/.local/bin/cyclonedx-cli ]]; then
curl -sSfL -o ~/.local/bin/cyclonedx-cli \
https://github.com/CycloneDX/cyclonedx-cli/releases/latest/download/cyclonedx-linux-x64
chmod +x ~/.local/bin/cyclonedx-cli
fi
cyclonedx-cli --version
- name: Update Grype database
if: github.event_name != 'schedule' || success()
run: |
export PATH="$HOME/.local/bin:$PATH"
grype db update || true
- name: Generate SBOM
id: generate
run: |
export PATH="$HOME/.local/bin:$PATH"
export VERSION="${{ steps.version.outputs.version }}"
export ARCH="${{ env.ARCH }}"
chmod +x scripts/sbom-generate.sh
./scripts/sbom-generate.sh --version "$VERSION" --arch "$ARCH"
echo "sbom_path=${SBOM_DIR}/secubox-${VERSION}.cdx.json" >> $GITHUB_OUTPUT
- name: Upload SBOM artifacts
uses: actions/upload-artifact@v4
with:
name: sbom-${{ steps.version.outputs.version }}
path: |
${{ env.SBOM_DIR }}/secubox-${{ steps.version.outputs.version }}.*
${{ env.SBOM_DIR }}/checksums.sha256
${{ env.SBOM_DIR }}/sbom-warnings.txt
retention-days: 90
sbom-publish:
name: Publish to Release
needs: sbom-generate
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Download SBOM artifacts
uses: actions/download-artifact@v4
with:
name: sbom-${{ needs.sbom-generate.outputs.version }}
path: sbom
- name: Attach to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
sbom/secubox-${{ needs.sbom-generate.outputs.version }}.cdx.json
sbom/secubox-${{ needs.sbom-generate.outputs.version }}.spdx.json
sbom/secubox-${{ needs.sbom-generate.outputs.version }}-cve-report.json
sbom/secubox-${{ needs.sbom-generate.outputs.version }}-cra-summary.txt
sbom/checksums.sha256
fail_on_unmatched_files: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
sbom-cve-gate:
name: CVE Gate Check
needs: sbom-generate
runs-on: ubuntu-24.04
timeout-minutes: 10
# Don't fail the whole workflow on schedule (weekly scan)
continue-on-error: ${{ github.event_name == 'schedule' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download SBOM artifacts
uses: actions/download-artifact@v4
with:
name: sbom-${{ needs.sbom-generate.outputs.version }}
path: sbom
- name: Check for critical CVEs
id: cve-check
run: |
CVE_REPORT="sbom/secubox-${{ needs.sbom-generate.outputs.version }}-cve-report.json"
if [[ ! -f "$CVE_REPORT" ]]; then
echo "No CVE report found"
exit 0
fi
CRITICAL_COUNT=$(jq '[.matches[]? | select(.vulnerability.severity == "Critical")] | length' "$CVE_REPORT" 2>/dev/null || echo 0)
HIGH_COUNT=$(jq '[.matches[]? | select(.vulnerability.severity == "High")] | length' "$CVE_REPORT" 2>/dev/null || echo 0)
echo "critical_count=${CRITICAL_COUNT}" >> $GITHUB_OUTPUT
echo "high_count=${HIGH_COUNT}" >> $GITHUB_OUTPUT
echo "=== CVE Summary ==="
echo "Critical: ${CRITICAL_COUNT}"
echo "High: ${HIGH_COUNT}"
if [[ "$CRITICAL_COUNT" -gt 0 ]]; then
echo "critical_cves=true" >> $GITHUB_OUTPUT
echo "::warning::Found ${CRITICAL_COUNT} CRITICAL CVEs"
echo "=== Critical CVEs ==="
jq -r '.matches[] | select(.vulnerability.severity == "Critical") | "\(.vulnerability.id): \(.artifact.name)@\(.artifact.version)"' "$CVE_REPORT"
fi
- name: Create security issue for critical CVEs
if: steps.cve-check.outputs.critical_cves == 'true'
uses: actions/github-script@v7
with:
script: |
const version = '${{ needs.sbom-generate.outputs.version }}';
const criticalCount = '${{ steps.cve-check.outputs.critical_count }}';
const title = `[Security] ${criticalCount} Critical CVE(s) found in SecuBox ${version}`;
const body = `## Automated Security Alert
The SBOM CVE scan found **${criticalCount} critical vulnerabilities** in SecuBox ${version}.
### Action Required
1. Review the CVE report attached to the release
2. Assess impact and exploitability
3. Update affected components or document VEX status
4. Update the VEX document if not affected
### References
- [CVE Report](https://github.com/${{ github.repository }}/releases/download/v${version}/secubox-${version}-cve-report.json)
- [CRA Summary](https://github.com/${{ github.repository }}/releases/download/v${version}/secubox-${version}-cra-summary.txt)
/cc @erdoukki
`;
// Check if issue already exists
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'security'
});
const existing = issues.find(i => i.title.includes(version) && i.title.includes('Critical CVE'));
if (existing) {
console.log(`Issue already exists: #${existing.number}`);
return;
}
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['security', 'cve', 'priority-critical'],
assignees: ['erdoukki']
});
- name: Fail on critical CVEs (release only)
if: github.event_name == 'push' && steps.cve-check.outputs.critical_cves == 'true'
run: |
echo "::error::Critical CVEs found - manual review required before release"
echo "See the security issue created for details"
exit 1

83
Makefile Normal file
View File

@ -0,0 +1,83 @@
# SecuBox SBOM Pipeline Makefile
# Convenience targets for CRA Annex I compliance
#
# Usage:
# make sbom - Generate full SBOM (all sources)
# make sbom-quick - Generate SBOM without rebuilding
# make sbom-validate - Validate existing SBOM
# make sbom-scan - CVE scan only
# make sbom-audit - Audit feed packages for metadata
# make sbom-prereqs - Check prerequisites
# make sbom-clean - Clean SBOM outputs
# make sbom-help - Show this help
.PHONY: sbom sbom-quick sbom-validate sbom-scan sbom-audit sbom-prereqs sbom-clean sbom-help
# Default version (can be overridden: make sbom VERSION=0.20)
VERSION ?= $(shell cat version 2>/dev/null || git describe --tags --always 2>/dev/null || echo "dev")
ARCH ?= aarch64_cortex-a53
SBOM_DIR ?= dist/sbom
sbom: sbom-prereqs
@echo "=== Generating Full SBOM ==="
./scripts/sbom-generate.sh --version "$(VERSION)" --arch "$(ARCH)"
sbom-quick:
@echo "=== Generating Quick SBOM (no rebuild) ==="
./scripts/sbom-generate.sh --version "$(VERSION)" --arch "$(ARCH)"
sbom-validate:
@echo "=== Validating SBOM ==="
@if command -v cyclonedx-cli >/dev/null 2>&1; then \
cyclonedx-cli validate --input-file "$(SBOM_DIR)/secubox-$(VERSION).cdx.json" \
--input-format json --input-version v1_6 || true; \
else \
echo "cyclonedx-cli not found. Install with:"; \
echo " curl -sSfL -o ~/.local/bin/cyclonedx-cli https://github.com/CycloneDX/cyclonedx-cli/releases/latest/download/cyclonedx-linux-x64"; \
echo " chmod +x ~/.local/bin/cyclonedx-cli"; \
fi
sbom-scan:
@echo "=== Running CVE Scan ==="
@if command -v grype >/dev/null 2>&1; then \
grype sbom:"$(SBOM_DIR)/secubox-$(VERSION).cdx.json" \
--output table \
--output json="$(SBOM_DIR)/secubox-$(VERSION)-cve-report.json"; \
else \
echo "grype not found. Install with:"; \
echo " curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b ~/.local/bin"; \
fi
sbom-audit:
@echo "=== Auditing Feed Packages ==="
./scripts/sbom-audit-feed.sh
sbom-prereqs:
@echo "=== Checking Prerequisites ==="
./scripts/check-sbom-prereqs.sh
sbom-clean:
@echo "=== Cleaning SBOM Outputs ==="
rm -rf "$(SBOM_DIR)"
@echo "Cleaned: $(SBOM_DIR)"
sbom-help:
@echo "SecuBox SBOM Pipeline Targets"
@echo "=============================="
@echo ""
@echo " make sbom - Generate full SBOM (all sources)"
@echo " make sbom-quick - Generate SBOM without rebuilding"
@echo " make sbom-validate - Validate existing SBOM"
@echo " make sbom-scan - CVE scan only"
@echo " make sbom-audit - Audit feed packages for metadata"
@echo " make sbom-prereqs - Check prerequisites"
@echo " make sbom-clean - Clean SBOM outputs"
@echo ""
@echo "Variables:"
@echo " VERSION=$(VERSION)"
@echo " ARCH=$(ARCH)"
@echo " SBOM_DIR=$(SBOM_DIR)"
@echo ""
@echo "Examples:"
@echo " make sbom VERSION=0.20"
@echo " make sbom-scan VERSION=0.20"

229
SECURITY.md Normal file
View File

@ -0,0 +1,229 @@
# Security Policy
## SecuBox Security Disclosure Policy
This document describes the security policy for SecuBox firmware, in compliance with
**EU Cyber Resilience Act (CRA) Article 13 §6** requirements for Class I products.
**Manufacturer:** CyberMind Produits SASU
**Contact:** Gérald Kerma, Notre-Dame-du-Cruet, Savoie, France
**Website:** https://cybermind.fr | https://secubox.in
---
## Supported Versions
| Version | Support Status | End of Support |
|---------|---------------|----------------|
| 0.20.x | ✅ Current | Active development |
| 0.19.x | ✅ LTS | March 2027 |
| 0.18.x | ⚠️ Security only | September 2026 |
| < 0.18 | EOL | Unsupported |
**Support policy:**
- **Current:** All bug fixes and security patches
- **LTS (Long Term Support):** Critical security patches only, 18 months
- **Security only:** Critical vulnerabilities only, 6 months after next major release
- **EOL (End of Life):** No updates, upgrade strongly recommended
---
## Reporting a Vulnerability
We take security vulnerabilities seriously. If you discover a security issue,
please report it responsibly.
### Primary Contact
**Email:** security@cybermind.fr
**PGP Key:** [0xABCD1234](https://secubox.in/pgp/security-key.asc)
**Fingerprint:** `1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678`
### Alternative Contact
For critical vulnerabilities requiring immediate attention:
- **Phone:** +33 (0)4 79 XX XX XX (French business hours)
- **Signal:** Available upon request via email
### Encrypted Communication
We **strongly recommend** using PGP encryption for vulnerability reports.
Our public key is available at:
- https://secubox.in/pgp/security-key.asc
- https://keys.openpgp.org (search: security@cybermind.fr)
### What to Include
Please provide:
1. **Description:** Clear description of the vulnerability
2. **Impact:** Potential security impact (confidentiality, integrity, availability)
3. **Affected versions:** Which SecuBox versions are affected
4. **Reproduction steps:** Step-by-step instructions to reproduce
5. **Proof of concept:** Code, logs, or screenshots if applicable
6. **Suggested fix:** If you have one (optional)
### Response Timeline
| Phase | Timeline |
|-------|----------|
| Acknowledgment | Within 48 hours |
| Initial triage | Within 5 business days |
| Status update | Every 7 days during investigation |
| Fix development | Depends on severity (see below) |
| Public disclosure | 90 days after fix, or coordinated |
**Severity-based fix timeline:**
- **Critical (CVSS 9.0+):** 7 days
- **High (CVSS 7.0-8.9):** 30 days
- **Medium (CVSS 4.0-6.9):** 60 days
- **Low (CVSS < 4.0):** Next regular release
---
## Software Bill of Materials (SBOM)
As required by CRA Annex I, we publish machine-readable SBOMs for all releases.
### SBOM Location
SBOMs are attached to each GitHub Release:
- **CycloneDX 1.6:** `secubox-VERSION.cdx.json`
- **SPDX 2.3:** `secubox-VERSION.spdx.json`
- **CVE Report:** `secubox-VERSION-cve-report.json`
- **Checksums:** `checksums.sha256`
**Direct link:** https://github.com/cybermind/secubox/releases/latest
### SBOM Contents
Our SBOM includes:
- All OpenWrt base packages
- SecuBox custom packages and dependencies
- Kernel modules and firmware blobs
- Cryptographic libraries and versions
- License information (SPDX identifiers)
- PURL (Package URL) identifiers for each component
### Verifying SBOM Integrity
```bash
# Download SBOM and checksums
wget https://github.com/cybermind/secubox/releases/latest/download/secubox-0.20.cdx.json
wget https://github.com/cybermind/secubox/releases/latest/download/checksums.sha256
# Verify checksum
sha256sum -c checksums.sha256 --ignore-missing
```
---
## Vulnerability Disclosure (VEX)
We use **Vulnerability Exploitability eXchange (VEX)** documents to communicate
the status of CVEs affecting SecuBox components.
### VEX Policy
See [docs/vex-policy.md](docs/vex-policy.md) for our full VEX handling policy.
**Status definitions:**
- `not_affected`: CVE does not affect SecuBox (component not used, conditions not met)
- `affected`: CVE affects SecuBox, fix in progress
- `fixed`: CVE fixed in specified version
- `under_investigation`: Analysis ongoing
VEX documents are published alongside releases:
- `secubox-VERSION.vex.json` (CycloneDX VEX format)
---
## CRA Compliance Statement
### EU Cyber Resilience Act — Class I Declaration
SecuBox is a **Class I product** under the EU Cyber Resilience Act (Regulation 2024/XXX),
as it is a router/VPN appliance with network connectivity functions.
**Compliance status:**
- ✅ SBOM published in machine-readable format (CycloneDX + SPDX)
- ✅ Vulnerability disclosure contact established
- ✅ Security update mechanism implemented (opkg + secubox-update)
- ✅ Default secure configuration
- ⏳ ANSSI CSPN certification: In progress (target Q3 2026)
### Certification Path
We are pursuing **ANSSI CSPN (Certification de Sécurité de Premier Niveau)**
certification for SecuBox, targeting completion in Q3 2026.
**Certification scope:**
- Firewall functionality
- VPN (WireGuard) implementation
- Intrusion detection (CrowdSec integration)
- Secure boot chain
- Update integrity verification
---
## Security Architecture
### Defense in Depth
SecuBox implements multiple security layers:
1. **Network Segmentation:** VLAN isolation, guest network separation
2. **WAF Protection:** mitmproxy-based web application firewall
3. **Intrusion Detection:** CrowdSec community threat intelligence
4. **Encrypted VPN:** WireGuard with modern cryptography
5. **Access Control:** SSO portal with MFA support
6. **Audit Logging:** Comprehensive security event logging
### Data Sovereignty
SecuBox includes an **AI Gateway** that enforces data classification:
- **LOCAL_ONLY:** Sensitive data (IPs, credentials) never leaves device
- **SANITIZED:** PII scrubbed before EU cloud processing (Mistral)
- **CLOUD_DIRECT:** Generic queries to opted-in providers
See [AI Gateway documentation](docs/ai-gateway.md) for details.
---
## Third-Party Components
SecuBox builds upon:
- **OpenWrt:** GPL-2.0, https://openwrt.org
- **CrowdSec:** MIT, https://crowdsec.net
- **WireGuard:** GPL-2.0, https://wireguard.com
- **mitmproxy:** MIT, https://mitmproxy.org
We monitor upstream security advisories and integrate patches promptly.
---
## Secure Development Practices
- **Code review:** All changes require peer review
- **Dependency scanning:** Automated CVE scanning in CI/CD
- **SBOM generation:** Automated with each release
- **Reproducible builds:** SOURCE_DATE_EPOCH enforced
- **Signed releases:** (Planned) cosign signatures for releases
---
## Contact
- **General security:** security@cybermind.fr
- **Support:** support@cybermind.fr
- **Commercial:** contact@cybermind.fr
**Address:**
CyberMind Produits SASU
Notre-Dame-du-Cruet
73130 Savoie, France
---
_Last updated: 2026-03-04_
_Document version: 1.0_

303
docs/sbom-pipeline.md Normal file
View File

@ -0,0 +1,303 @@
# SecuBox SBOM Pipeline Documentation
## Overview
The SecuBox SBOM (Software Bill of Materials) pipeline generates CycloneDX 1.6 and
SPDX 2.3 compliant SBOMs for EU Cyber Resilience Act (CRA) Annex I compliance.
## Architecture
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ SecuBox SBOM Pipeline │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Source A │ │ Source B │ │ Source C │ │ Source D │ │
│ │ OpenWrt │ │ SecuBox │ │ Rootfs │ │ Firmware │ │
│ │ Native │ │ Feed │ │ Scan │ │ Image │ │
│ │ │ │ │ │ │ │ │ │
│ │ Packages │ │ Makefiles │ │ Syft scan │ │ Syft scan │ │
│ │ .manifest │ │ PKG_* vars │ │ dir:rootfs │ │ file:*.bin │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │ │
│ └──────────────────┴──────────────────┴──────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Merge & Dedup │ │
│ │ (jq fusion) │ │
│ └────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Validate │ │
│ │ cyclonedx-cli │ │
│ └────────┬────────┘ │
│ │ │
│ ┌──────────────┼──────────────┐ │
│ ▼ ▼ ▼ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ CVE Scan │ │ CRA Report│ │ Checksums │ │
│ │ (grype) │ │ Summary │ │ sha256sum │ │
│ └───────────┘ └───────────┘ └───────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Output Files:
├── secubox-VERSION.cdx.json # CycloneDX 1.6 (primary)
├── secubox-VERSION.spdx.json # SPDX 2.3 (alternative)
├── secubox-VERSION-cve-report.json # Grype CVE scan results
├── secubox-VERSION-cve-table.txt # Human-readable CVE table
├── secubox-VERSION-cra-summary.txt # CRA compliance summary
├── sbom-warnings.txt # Missing metadata warnings
└── checksums.sha256 # File integrity checksums
```
## Prerequisites
### Minimum Versions
| Tool | Minimum Version | Purpose |
|------|-----------------|---------|
| OpenWrt | 22.03 | Native SBOM support |
| Perl | 5.26+ | package-metadata.pl |
| jq | 1.6+ | JSON processing |
| Syft | 0.100+ | Filesystem scanning |
| Grype | 0.70+ | CVE scanning |
| cyclonedx-cli | 0.25+ | SBOM validation |
### Environment Setup
```bash
# Check prerequisites
./scripts/check-sbom-prereqs.sh
# Install SBOM tools (if not present)
# Syft
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b ~/.local/bin
# Grype
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b ~/.local/bin
# cyclonedx-cli
curl -sSfL -o ~/.local/bin/cyclonedx-cli \
https://github.com/CycloneDX/cyclonedx-cli/releases/latest/download/cyclonedx-linux-x64
chmod +x ~/.local/bin/cyclonedx-cli
# Add to PATH
export PATH="$HOME/.local/bin:$PATH"
```
### OpenWrt Kconfig
Enable native SBOM generation in `.config`:
```
CONFIG_JSON_CYCLONEDX_SBOM=y
CONFIG_COLLECT_KERNEL_DEBUG=n
```
## Usage
### Daily Development
```bash
# Full SBOM generation (all 4 sources)
./scripts/sbom-generate.sh
# Quick SBOM from existing artifacts (no rebuild)
./scripts/sbom-generate.sh --version 0.20
# Offline mode (no network, uses cached databases)
./scripts/sbom-generate.sh --offline
# Skip CVE scan (faster)
./scripts/sbom-generate.sh --no-cve
```
### Using Makefile Targets
```bash
# Full build + SBOM
make sbom
# SBOM only (no rebuild)
make sbom-quick
# Validate existing SBOM
make sbom-validate
# CVE scan only
make sbom-scan
# Clean SBOM outputs
make sbom-clean
# Show help
make sbom-help
```
### Audit Feed Packages
```bash
# Check all SecuBox feed packages for missing metadata
./scripts/sbom-audit-feed.sh
# Output: feeds/secubox/MANIFEST.md
```
## Adding a New Package
When adding a new package to the SecuBox feed, ensure SBOM compatibility:
### Checklist
- [ ] **PKG_NAME** defined
- [ ] **PKG_VERSION** defined
- [ ] **PKG_LICENSE** defined (SPDX identifier)
- [ ] **PKG_HASH** defined (sha256)
- [ ] **PKG_SOURCE_URL** defined (optional but recommended)
### Example Makefile
```makefile
include $(TOPDIR)/rules.mk
PKG_NAME:=my-package
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/example/my-package/archive
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_HASH:=a1b2c3d4e5f6... # sha256sum of the source tarball
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Your Name <email@example.com>
```
### Compute PKG_HASH
```bash
# Download and hash the source
wget https://example.com/package-1.0.0.tar.gz
sha256sum package-1.0.0.tar.gz
# Or use the OpenWrt download helper
make package/my-package/download V=s
sha256sum dl/my-package-1.0.0.tar.gz
```
## CRA Annex I Mapping
| CRA Requirement | SBOM Implementation |
|-----------------|---------------------|
| Art. 13(5) - Component identification | `components[].purl` (Package URL) |
| Art. 13(5) - Supplier identification | `metadata.component.supplier` |
| Art. 13(5) - Version information | `components[].version` |
| Art. 13(5) - Dependencies | `dependencies[]` array |
| Art. 13(5) - License information | `components[].licenses[]` |
| Art. 13(6) - Machine-readable format | CycloneDX 1.6 JSON + SPDX 2.3 |
| Art. 13(6) - Vulnerability disclosure | SECURITY.md + VEX documents |
| Art. 13(7) - Unique identification | PURL + `serialNumber` UUID |
| Annex I(2) - Integrity verification | `hashes[]` with SHA-256 |
## ANSSI CSPN Submission
For CSPN certification, include the following in your dossier:
### Required Documents
1. **SBOM Files**
- `secubox-VERSION.cdx.json` (primary)
- `secubox-VERSION.spdx.json` (alternative)
2. **Provenance**
- `checksums.sha256` (integrity verification)
- Git commit hash from metadata
3. **Vulnerability Analysis**
- `secubox-VERSION-cve-report.json`
- `secubox-VERSION-cra-summary.txt`
4. **Process Documentation**
- This document (`docs/sbom-pipeline.md`)
- `SECURITY.md` (vulnerability disclosure policy)
### Submission Checklist
- [ ] All components have PKG_HASH and PKG_LICENSE
- [ ] SBOM validates with cyclonedx-cli
- [ ] No unaddressed Critical CVEs
- [ ] VEX document explains any accepted risks
- [ ] SOURCE_DATE_EPOCH reproducibility verified
## Troubleshooting
### Common Errors
#### "OpenWrt version < 22.03"
The native CycloneDX SBOM support requires OpenWrt 22.03 or later.
**Solution:** Upgrade your OpenWrt fork or use `sbom-generate.sh` without native support
(it will fall back to Makefile parsing).
#### "package-metadata.pl not found"
The SBOM generation script is missing from your OpenWrt checkout.
**Solution:**
```bash
git checkout origin/master -- scripts/package-metadata.pl
```
#### "syft: command not found"
Syft is not installed or not in PATH.
**Solution:**
```bash
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b ~/.local/bin
export PATH="$HOME/.local/bin:$PATH"
```
#### "SBOM validation failed"
The generated SBOM has schema errors.
**Solution:**
1. Check `sbom-warnings.txt` for missing metadata
2. Fix Makefiles with missing PKG_HASH or PKG_LICENSE
3. Regenerate SBOM
#### "Grype database update failed"
Network connectivity issue or rate limiting.
**Solution:**
- Use `--offline` mode with cached database
- Or manually update: `grype db update`
### Debug Mode
```bash
# Verbose output
DEBUG=1 ./scripts/sbom-generate.sh
# Keep intermediate files
KEEP_TEMP=1 ./scripts/sbom-generate.sh
```
## Version History
| Version | Date | Changes |
|---------|------|---------|
| 1.0 | 2026-03-04 | Initial pipeline implementation |
---
_Maintained by CyberMind Produits SASU_
_Contact: secubox@cybermind.fr_

Some files were not shown because too many files have changed in this diff Show More