Skip to content

Security Scan

Security Scan #61

Workflow file for this run

name: Security Scan
on:
pull_request:
branches: ["**"]
push:
branches: [main, develop]
schedule:
- cron: "0 8 * * 1" # weekly Monday 08:00 UTC
permissions:
contents: read
security-events: write
jobs:
codeql:
name: CodeQL (Java SAST)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: "21"
- name: Initialize CodeQL
uses: github/codeql-action/init@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
with:
languages: java
queries: +security-extended
- name: Build with Maven
run: ./mvnw -B compile -DskipTests -pl ice,ice-rest-catalog
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
with:
category: "/language:java"
trivy:
name: Trivy Filesystem Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Trivy (table output for logs)
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: fs
scan-ref: .
scanners: vuln
severity: CRITICAL,HIGH
exit-code: "1"
format: table
trivy-config: trivy.yaml
- name: Run Trivy (SARIF for GitHub Security tab)
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
if: always()
with:
scan-type: fs
scan-ref: .
scanners: vuln
severity: CRITICAL,HIGH
exit-code: "0"
format: sarif
output: trivy-results.sarif
trivy-config: trivy.yaml
- name: Upload Trivy SARIF to GitHub Security
uses: github/codeql-action/upload-sarif@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
if: always()
with:
sarif_file: trivy-results.sarif
grype:
name: Grype Dependency Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Grype (table output for logs)
uses: anchore/scan-action@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7.4.0
with:
path: .
fail-build: "true"
severity-cutoff: high
output-format: table
- name: Run Grype (SARIF for GitHub Security tab)
uses: anchore/scan-action@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7.4.0
if: always()
id: grype-sarif
with:
path: .
fail-build: "false"
severity-cutoff: high
output-format: sarif
- name: Upload Grype SARIF to GitHub Security
uses: github/codeql-action/upload-sarif@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
if: always()
with:
sarif_file: ${{ steps.grype-sarif.outputs.sarif }}
category: grype