mirror of
https://github.com/LearningCircuit/local-deep-research.git
synced 2026-06-15 19:46:56 +03:00
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.3 to 4.35.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e46ed2cbd0...68bde559de)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 4.35.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
167 lines
5.2 KiB
YAML
167 lines
5.2 KiB
YAML
name: Container Security
|
|
|
|
on:
|
|
workflow_call: # Called by release-gate.yml
|
|
workflow_dispatch:
|
|
|
|
permissions: {} # Minimal top-level for OSSF Scorecard Token-Permissions
|
|
|
|
jobs:
|
|
trivy-scan:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: read
|
|
security-events: write
|
|
actions: read
|
|
|
|
steps:
|
|
- name: Harden the runner (Audit all outbound calls)
|
|
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Free up disk space
|
|
run: |
|
|
# Remove unnecessary files to free up disk space for Docker image scanning
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /usr/local/lib/android
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
|
sudo docker image prune -af
|
|
df -h
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
|
|
|
- name: Build Docker image for scanning
|
|
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
|
with:
|
|
context: .
|
|
push: false
|
|
load: true
|
|
tags: local-deep-research:scan
|
|
cache-from: type=gha,scope=trivy-scan
|
|
cache-to: type=gha,mode=max,scope=trivy-scan
|
|
|
|
- name: Run Trivy vulnerability scanner
|
|
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
with:
|
|
image-ref: local-deep-research:scan
|
|
format: 'sarif'
|
|
output: 'trivy-results.sarif'
|
|
severity: 'CRITICAL,HIGH,MEDIUM'
|
|
ignore-unfixed: true
|
|
scan-type: 'image'
|
|
trivyignores: '.trivyignore'
|
|
version: 'v0.69.2'
|
|
|
|
- name: Check if SARIF file exists
|
|
id: check-sarif
|
|
if: always()
|
|
run: |
|
|
if [ -f trivy-results.sarif ]; then
|
|
echo "exists=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "::error::Trivy did not produce trivy-results.sarif — scan needs to be rerun"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
|
uses: github/codeql-action/upload-sarif@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
|
|
if: always() && steps.check-sarif.outputs.exists == 'true'
|
|
with:
|
|
sarif_file: 'trivy-results.sarif'
|
|
category: container-security
|
|
|
|
- name: Upload Trivy scan results as artifact
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: always() && steps.check-sarif.outputs.exists == 'true'
|
|
with:
|
|
name: trivy-scan-results
|
|
path: trivy-results.sarif
|
|
retention-days: 7 # Reduced for security
|
|
|
|
- name: Display Trivy summary
|
|
if: always()
|
|
run: |
|
|
{
|
|
echo "## Container Security Scan Summary"
|
|
echo ""
|
|
if [ -f trivy-results.sarif ]; then
|
|
echo "✅ Trivy scan completed - Results available in Security tab"
|
|
echo "📊 Scan results uploaded as artifact"
|
|
else
|
|
echo "❌ Trivy scan failed"
|
|
fi
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
# Additional job for Dockerfile security analysis
|
|
dockerfile-scan:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: read
|
|
security-events: write
|
|
|
|
steps:
|
|
- name: Harden the runner (Audit all outbound calls)
|
|
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Run Trivy config scan on Dockerfile
|
|
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
with:
|
|
scan-type: 'config'
|
|
scan-ref: '.'
|
|
format: 'sarif'
|
|
output: 'trivy-config-results.sarif'
|
|
hide-progress: true
|
|
version: 'v0.69.2'
|
|
|
|
- name: Check if config SARIF file exists
|
|
id: check-config-sarif
|
|
if: always()
|
|
run: |
|
|
if [ -f trivy-config-results.sarif ]; then
|
|
echo "exists=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "::error::Trivy did not produce trivy-config-results.sarif — scan needs to be rerun"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Upload Trivy config scan results
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: always() && steps.check-config-sarif.outputs.exists == 'true'
|
|
with:
|
|
name: trivy-config-results
|
|
path: trivy-config-results.sarif
|
|
retention-days: 7 # Reduced for security
|
|
|
|
- name: Display config scan summary
|
|
if: always()
|
|
run: |
|
|
{
|
|
echo "## Docker Configuration Security Analysis"
|
|
echo ""
|
|
if [ -f trivy-config-results.sarif ]; then
|
|
echo "✅ Docker configuration analysis completed"
|
|
echo "📋 Check for Docker best practices and security misconfigurations"
|
|
else
|
|
echo "❌ Docker configuration scan failed"
|
|
fi
|
|
} >> "$GITHUB_STEP_SUMMARY"
|