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

Enable dependabot #9

Merged
merged 13 commits into from
Sep 2, 2024
1 change: 1 addition & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: "MCM CodeQL Config"
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /.github
schedule:
interval: "weekly"
day: "sunday"

- package-ecosystem: docker
directory: /docker
schedule:
interval: "weekly"
day: "sunday"
66 changes: 66 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "CodeQL"

on:
push:
branches: [ "master", "main", "dev" ]
pull_request:
branches: [ "master", "main", "dev" ]
schedule:
- cron: '42 8 * * 1'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
PREFIX_DIR: /usr/local
DEBIAN_FRONTEND: noninteractive

permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ${{ matrix.runner-os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
runner-os: [ 'ubuntu-22.04' ]
permissions:
actions: read
contents: read
security-events: write
defaults:
run:
shell: bash

steps:
- name: 'Harden Runner'
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- name: 'Checkout repository'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: 'Initialize CodeQL'
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
languages: 'c-cpp'
build-mode: autobuild
# config-file: ${{ github.workspace }}/.github/codeql/codeql-config.yml

- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
23 changes: 23 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Dependency Review Action
#
# Source repository: https://github.com/actions/dependency-review-action
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Harden Runner'
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: 'Dependency Review'
uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3
66 changes: 66 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Docker Build
on:
push:
branches: [ "master", "main" ]
pull_request:
branches: [ "master", "main" ]

permissions:
contents: read

jobs:
docker-build:
name: Dockerfiles Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dockerfiles: [ 'ubuntu22.04', 'ubuntu18.04', 'centos7.9' ]
permissions:
actions: read
contents: read
security-events: write
defaults:
run:
shell: bash
timeout-minutes: 90
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up QEMU
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
with:
buildkitd-flags: --debug

- name: 'Build Dockerfile for ${{ matrix.dockerfiles }}'
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0
with:
file: '${{ github.workspace }}/docker/Dockerfile.${{ matrix.dockerfiles }}'
context: .
push: false
tags: 'docker.io/openvisualcloud/raisr/${{ matrix.dockerfiles }}:${{ github.sha }}'

- name: 'Run Trivy vulnerability scanner on result'
uses: aquasecurity/trivy-action@0.20.0
with:
image-ref: 'docker.io/openvisualcloud/raisr/${{ matrix.dockerfiles }}:${{ github.sha }}'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
format: 'sarif'
output: '${{ github.workspace }}/trivy-${{ matrix.dockerfiles }}-${{ github.sha }}.sarif'

- name: 'Upload Trivy scan results to GitHub Security tab'
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: '${{ github.workspace }}/trivy-${{ matrix.dockerfiles }}-${{ github.sha }}.sarif'
39 changes: 39 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Trivy
on:
push:
branches:
- main
pull_request:
permissions:
contents: read

jobs:
scan-type-config:
runs-on: ubuntu-22.04
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
name: scan-type-config
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Run Trivy vulnerability scanner, scan-type=config
uses: aquasecurity/trivy-action@7c2007bcb556501da015201bcba5aa14069b74e2 # v0.23.0
with:
scan-type: 'config'
hide-progress: false
ignore-unfixed: true
format: 'sarif'
output: 'trivy-config-results.sarif'
severity: 'CRITICAL,HIGH,MEDIUM'

- name: Upload Trivy config scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
sarif_file: 'trivy-config-results.sarif'
Loading