Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security scan and Dependabot configuration #86

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
github-actions-dependency:
applies-to: version-updates
patterns:
- "*"

- package-ecosystem: pub
directory: /
open-pull-requests-limit: 3
schedule:
interval: weekly
105 changes: 105 additions & 0 deletions .github/workflows/security-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: "Security scan"

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main

permissions: {}

jobs:
Trivy:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Run Trivy Scan (vuln)
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
with:
scan-type: fs
scan-ref: pubspec.lock
scanners: vuln
output: trivy-results-vuln.txt

- name: Run Trivy Scan (misconfigs and secrets)
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
with:
scan-type: fs
scan-ref: .
scanners: misconfig,secret
output: trivy-results-misconfig.txt

- name: Run Trivy Scan (spdx)
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # 0.29.0
with:
scan-type: fs
scan-ref: .
format: spdx-json
output: trivy-results-spdx.json

- name: Upload Trivy results
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
if: always()
with:
name: trivy-results
path: "${{ github.workspace }}/trivy-results-*"
retention-days: 7

CodeQL:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-22.04
permissions:
# Needed to upload the SARIF results to code-scanning dashboard
security-events: write

strategy:
fail-fast: false
matrix:
include:
- language: actions # to scan workflows
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
category: "/language:${{matrix.language}}"

Summarize:
needs: [Trivy]
if: always()
runs-on: ubuntu-22.04
steps:
# Create directory first
- name: Create results directory
run: mkdir -p all-results

# Download artifacts with error handling
- name: Download all results
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
continue-on-error: true # Don't fail if some tools didn't generate results
with:
pattern: "*-results"
merge-multiple: true
path: all-results

# Only upload if there are files
- name: Upload combined results
if: hashFiles('all-results/**/*') != ''
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: security-scan-results
path: all-results
retention-days: 7
Loading