Repository navigation
Bump the prod-dependencies-minor-patch group across 1 directory with 53 updates #148
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Trivy Security Scan & SBOM | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| schedule: | |
| # Run weekly every Monday at 06:00 UTC | |
| - cron: '0 6 * * 1' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| security-events: write | |
| jobs: | |
| security-scan: | |
| name: Trivy Security Scan & SBOM Generation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Install Trivy | |
| run: | | |
| echo "Installing latest official Trivy release..." | |
| curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin | |
| trivy --version | |
| - name: Scan IaC & Configuration | |
| run: | | |
| echo "Scanning Dockerfiles, Compose, and configurations..." | |
| trivy config --severity CRITICAL,HIGH,MEDIUM,LOW --format table . || true | |
| - name: Scan Filesystem & Dependencies | |
| run: | | |
| echo "Scanning filesystem dependencies..." | |
| trivy fs --scanners vuln --severity CRITICAL,HIGH,MEDIUM,LOW --format table --skip-dirs node_modules,dist,client/dist,server/dist . || true | |
| - name: Generate Application SBOM (CycloneDX JSON) | |
| run: | | |
| echo "Generating Application CycloneDX SBOM..." | |
| mkdir -p sbom-artifacts | |
| trivy fs --format cyclonedx --output sbom-artifacts/secureshare-fs-sbom.cdx.json --skip-dirs node_modules,dist,client/dist,server/dist . | |
| - name: Build Docker Images for Scanning | |
| run: | | |
| echo "Building Server Docker image..." | |
| docker build -t secureshare-server:latest -f server/Dockerfile server | |
| echo "Building Client Docker image..." | |
| docker build -t secureshare-client:latest -f client/Dockerfile client | |
| - name: Scan Server Docker Image | |
| run: | | |
| echo "Scanning Server Docker image..." | |
| trivy image --scanners vuln --severity CRITICAL,HIGH,MEDIUM,LOW --format table secureshare-server:latest || true | |
| - name: Scan Client Docker Image | |
| run: | | |
| echo "Scanning Client Docker image..." | |
| trivy image --scanners vuln --severity CRITICAL,HIGH,MEDIUM,LOW --format table secureshare-client:latest || true | |
| - name: Generate Docker Images SBOMs (CycloneDX JSON) | |
| run: | | |
| echo "Generating Docker Images CycloneDX SBOMs..." | |
| trivy image --format cyclonedx --output sbom-artifacts/secureshare-server-image-sbom.cdx.json secureshare-server:latest | |
| trivy image --format cyclonedx --output sbom-artifacts/secureshare-client-image-sbom.cdx.json secureshare-client:latest | |
| - name: Upload SBOM Artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: secureshare-sbom | |
| path: sbom-artifacts/ | |
| retention-days: 30 |