ci(deps): bump actions/download-artifact from 4 to 5 #147
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: Security | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
schedule: | |
# Run security scan daily at 2 AM UTC | |
- cron: '0 2 * * *' | |
jobs: | |
codeql: | |
name: CodeQL Analysis | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
language: ['python'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install UV | |
uses: astral-sh/setup-uv@v4 | |
with: | |
version: "latest" | |
- name: Install dependencies | |
run: | | |
uv sync | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
queries: +security-and-quality | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
with: | |
category: "/language:${{matrix.language}}" | |
security: | |
name: Security Scanning | |
runs-on: ubuntu-latest | |
permissions: | |
security-events: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install UV | |
uses: astral-sh/setup-uv@v4 | |
with: | |
version: "latest" | |
- name: Install dependencies | |
run: | | |
uv sync | |
- name: Run Safety to check for vulnerabilities | |
uses: pyupio/safety-action@v1 | |
with: | |
api-key: ${{ secrets.SAFETY_API_KEY }} | |
- name: Run Bandit security scan | |
run: | | |
uv run bandit -r src/ -f json -o bandit-results.json || true | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
scan-type: 'fs' | |
scan-ref: '.' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
severity: 'CRITICAL,HIGH' | |
exit-code: '0' # Don't fail the workflow if vulnerabilities are found | |
- name: Check if Trivy results exist | |
id: check_results | |
run: | | |
if [ -f trivy-results.sarif ]; then | |
echo "results_exist=true" >> $GITHUB_OUTPUT | |
else | |
echo "results_exist=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
if: steps.check_results.outputs.results_exist == 'true' | |
with: | |
sarif_file: 'trivy-results.sarif' |