# EU CRA Article 14 GitHub Action (Lockfiles, Syft & Trivy SBOMs)

> Copy-paste GitHub Actions workflows for EU CRA Article 14 compliance using theperipetycompany/cra-switch-action@v1 (Mode A lockfile attestation and Mode B Syft / Trivy CycloneDX & SPDX SBOM upload).
> Canonical URL: https://craswitch.dev/docs/eu-cra-article-14-github-action
> LLM Index: https://craswitch.dev/llms.txt

## 1. Zero-Auth CLI Quickstart (`@craswitch/cli`)

```bash
# Zero-auth local CRA Article 14 check (auto-JSON when piped / non-TTY)
npx -y @craswitch/cli scan --json

# Fail CI only on vendor-confirmed active exploitation (4-state triage safe)
npx -y @craswitch/cli scan --fail-on-confirmed --out-dir .cra-switch --json
```

## 2. GitHub Action Workflow (`theperipetycompany/cra-switch-action@v1`)

```yaml
# Mode A — Release-Tag Lockfile Attestation (Free for unlimited public repos)
name: EU CRA Article 14 Check
on: [push, pull_request, release]
jobs:
  cra-article-14:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
      - id: cra
        uses: theperipetycompany/cra-switch-action@v1
        with:
          fail-on-confirmed: 'true'
          out-dir: '.cra-switch'
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: cra-sbom-vex
          path: |
            ${{ steps.cra.outputs.sbom-path }}
            ${{ steps.cra.outputs.vex-path }}
```

## 3. Mode B Recipe 1 — Chain anchore/sbom-action (Syft) into CRA-Switch

```
# Generate CycloneDX 1.6 SBOM with Syft (C/C++/Go/Docker) and upload to CRA-Switch
      - name: Generate SBOM with Syft
        uses: anchore/sbom-action@v0
        with:
          format: cyclonedx-json
          output-file: dist/app.cdx.json

      - name: Evaluate & Upload SBOM to CRA-Switch (Mode B)
        uses: theperipetycompany/cra-switch-action@v1
        with:
          sbom-path: dist/app.cdx.json
          cra-switch-url: 'https://craswitch.dev'
          sbom-api-token: ${{ secrets.CRA_SWITCH_SBOM_API_TOKEN }}
          fail-on-confirmed: 'true'
```

## 4. Mode B Recipe 2 — Chain aquasecurity/trivy-action (Trivy) into CRA-Switch

```
# Generate SPDX 2.3 SBOM with Trivy and upload to CRA-Switch
      - name: Generate SPDX 2.3 SBOM with Trivy
        uses: aquasecurity/trivy-action@0.28.0
        with:
          scan-type: fs
          format: spdx-json
          output: dist/app.spdx.json

      - name: Evaluate & Upload SPDX SBOM to CRA-Switch (Mode B)
        uses: theperipetycompany/cra-switch-action@v1
        with:
          sbom-path: dist/app.spdx.json
          cra-switch-url: 'https://craswitch.dev'
          sbom-api-token: ${{ secrets.CRA_SWITCH_SBOM_API_TOKEN }}
          fail-on-confirmed: 'true'
```

## Mode A vs Mode B GitHub Action Inputs & Outputs

| Mode / Input | Default | Purpose |
| --- | --- | --- |
| Mode A (lockfile-paths) | auto-discover | Parses 7 lockfiles (npm, pnpm, Cargo, Go, pip, Poetry, Maven) with zero external deps |
| Mode B (sbom-path) | "" | Accepts pre-built CycloneDX 1.6 or SPDX 2.3 JSON from Syft, Trivy, or Cargo Auditable |
| fail-on-confirmed | 'false' (recommended 'true') | Exits 1 ONLY on vendor-confirmed active exploitation — never breaks CI on unconfirmed triage_required matches |
| sbom-api-token | "" | Bearer token for POST /api/v1/sbom on Scale ($149/mo) & Organization ($399/mo) private repos |
| Outputs | triage-state, sbom-path, vex-path | Emits CycloneDX 1.6 SBOM, OpenVEX v0.2.0, and 4-state triage summary in GITHUB_STEP_SUMMARY |

## Key Guardrails & Facts

- Free forever for unlimited public GitHub repositories ($0/mo OSS tier) with live /.well-known/vex.json buyer trust portals.
- Raw lockfile/SBOM KEV hits always enter triage_required (4-hour internal triage SLA) and never start the statutory 24-hour ENISA Article 14 clock without explicit maintainer confirmation.
- Private repositories scale smoothly on Polar.sh fiat billing: Team $49/mo (5 private repos), Scale $149/mo (35 private repos + CI SBOM API), Organization $399/mo (unlimited private repos + 10-year Customer-Owned WORM export).

## Related CRA-Switch Guides & Free Utilities

- Interactive tool: [Open Lockfile & SBOM Scanner](https://craswitch.dev/tools/scanner)
- Canonical LLM index: [llms.txt](https://craswitch.dev/llms.txt)
- Developer API & MCP reference: [/docs/api](https://craswitch.dev/docs/api)
- [ENISA SRP 24h Worksheet JSON](https://craswitch.dev/docs/enisa-srp-early-warning-worksheet) ([Markdown](https://craswitch.dev/docs/enisa-srp-early-warning-worksheet.md))
- [.cra-vex.json & OpenVEX Ed25519](https://craswitch.dev/docs/cra-vex-openvex-ed25519) ([Markdown](https://craswitch.dev/docs/cra-vex-openvex-ed25519.md))
- [CISA KEV & ENISA EUVD Scanner](https://craswitch.dev/docs/cisa-kev-enisa-euvd-lockfile-scanner) ([Markdown](https://craswitch.dev/docs/cisa-kev-enisa-euvd-lockfile-scanner.md))

> DRAFT COMPLIANCE AID ONLY — NOT LEGAL ADVICE. CRA-Switch aggregates public vulnerability feeds (CISA KEV, ENISA EUVD, OSV/GHSA) on a best-effort basis and NEVER auto-submits reports to ENISA. The software vendor remains solely responsible for verifying exploitability and submitting official Article 14 notifications via https://portal.cra-srp.enisa.europa.eu within statutory deadlines.
