mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-01-01 14:19:28 +03:00
- Update Bun from 1.2.14 to 1.2.18 to address CVE-2025-22874 - Pin Trivy action to stable version (0.28.0) - Add SARIF output for GitHub Security tab integration - Set ignore-unfixed to false for comprehensive vulnerability detection - Add security-events permission for uploading scan results - Include fallback table output on scan failures
77 lines
1.8 KiB
YAML
77 lines
1.8 KiB
YAML
name: Docker Security Scan
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'Dockerfile'
|
|
- '.dockerignore'
|
|
- 'package.json'
|
|
- 'bun.lock*'
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'Dockerfile'
|
|
- '.dockerignore'
|
|
- 'package.json'
|
|
- 'bun.lock*'
|
|
schedule:
|
|
- cron: '0 0 * * 0' # Run weekly on Sunday at midnight
|
|
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
security-events: write
|
|
|
|
jobs:
|
|
scan:
|
|
name: Scan Docker Image
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver-opts: network=host
|
|
|
|
- name: Build Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: false
|
|
load: true
|
|
tags: gitea-mirror:scan
|
|
# Disable GitHub Actions cache for this workflow
|
|
no-cache: true
|
|
|
|
- name: Run Trivy vulnerability scanner
|
|
uses: aquasecurity/trivy-action@0.28.0
|
|
with:
|
|
image-ref: gitea-mirror:scan
|
|
format: 'sarif'
|
|
output: 'trivy-results.sarif'
|
|
exit-code: '1'
|
|
ignore-unfixed: false
|
|
vuln-type: 'os,library'
|
|
severity: 'CRITICAL,HIGH'
|
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
|
uses: github/codeql-action/upload-sarif@v3
|
|
if: always()
|
|
with:
|
|
sarif_file: 'trivy-results.sarif'
|
|
|
|
- name: Run Trivy vulnerability scanner (table output)
|
|
uses: aquasecurity/trivy-action@0.28.0
|
|
if: failure()
|
|
with:
|
|
image-ref: gitea-mirror:scan
|
|
format: 'table'
|
|
exit-code: '0'
|
|
ignore-unfixed: false
|
|
vuln-type: 'os,library'
|
|
severity: 'CRITICAL,HIGH'
|