diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..253bcb7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0e7ddc7..d0b85be 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,9 @@ name: CI Build & Test # Triggers the workflow on push or pull request events on: [push, pull_request] +permissions: + contents: read + jobs: build: strategy: @@ -96,8 +99,13 @@ jobs: runs-on: ${{ matrix.os }} steps: + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: submodules: 'True' diff --git a/.github/workflows/codacy.yaml b/.github/workflows/codacy.yaml index 628d642..89a8d2f 100644 --- a/.github/workflows/codacy.yaml +++ b/.github/workflows/codacy.yaml @@ -6,6 +6,9 @@ on: - v2 pull_request: types: [opened, synchronize, reopened] +permissions: + contents: read + jobs: tidy: name: Tidy @@ -22,7 +25,12 @@ jobs: CCT_OUT: /tmp/cct-out steps: - - uses: actions/checkout@v3 + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: submodules: 'True' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 977b318..4212fc7 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -20,6 +20,9 @@ on: schedule: - cron: '28 5 * * 4' +permissions: + contents: read + jobs: analyze: name: Analyze @@ -39,12 +42,17 @@ jobs: # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@0116bc2df50751f9724a2e35ef1f24d22f90e4e1 # v2.22.3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -58,7 +66,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@0116bc2df50751f9724a2e35ef1f24d22f90e4e1 # v2.22.3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -71,6 +79,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@0116bc2df50751f9724a2e35ef1f24d22f90e4e1 # v2.22.3 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/coverity.yaml b/.github/workflows/coverity.yaml index 6ead1f3..f0148b5 100644 --- a/.github/workflows/coverity.yaml +++ b/.github/workflows/coverity.yaml @@ -1,5 +1,8 @@ name: Coverity Scan on: workflow_dispatch +permissions: + contents: read + jobs: coverity: name: Coverity Scan @@ -11,7 +14,12 @@ jobs: BUILD_TOOL_DIR: "${{ github.workspace }}/coverity-build" steps: - - uses: actions/checkout@v3 + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: submodules: 'True' @@ -33,7 +41,7 @@ jobs: - name: Cache the Coverity Build Tool id: cache-build-tool - uses: actions/cache@v3 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 with: key: coverity-${{ runner.os }}-${{ steps.get-cov-md5.outputs.md5 }} path: '${{ env.BUILD_TOOL_DIR }}/coverity_tool.tgz' diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..9c697a4 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,27 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, +# surfacing known-vulnerable versions of the packages declared or updated in the PR. +# Once installed, if the workflow run is marked as required, +# PRs introducing known-vulnerable packages will be blocked from merging. +# +# 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@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + + - name: 'Checkout Repository' + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + - name: 'Dependency Review' + uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 8509ad8..71d37c6 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -1,5 +1,8 @@ name: Doxygen on: workflow_dispatch +permissions: + contents: read + jobs: doxygen: name: Build Doxygen Docs @@ -9,7 +12,12 @@ jobs: VERSION: 1.9.7 steps: - - uses: actions/checkout@v3 + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: submodules: 'True' @@ -20,7 +28,7 @@ jobs: - name: Cache the Doxygen binary id: cache-binary - uses: actions/cache@v3 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 with: key: 'doxygen-${{ runner.os }}-${{ env.VERSION }}' path: '${{ env.TOOL_DIR }}/doxygen.tgz' @@ -50,7 +58,7 @@ jobs: tar czf ./docs.tgz docs - name: Upload Documentation - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: docs path: ./docs.tgz diff --git a/.github/workflows/klee.yaml b/.github/workflows/klee.yaml index 2a2045d..9b68940 100644 --- a/.github/workflows/klee.yaml +++ b/.github/workflows/klee.yaml @@ -13,6 +13,9 @@ on: # The branches below must be a subset of the branches above branches: [ "main" ] workflow_dispatch: +permissions: + contents: read + jobs: klee: runs-on: ubuntu-latest @@ -20,6 +23,11 @@ jobs: image: klee/klee:2.3 options: -u 0 --ulimit="stack=-1:-1" steps: + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + - name: Get the Kitware APT repository signing key run: | wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null @@ -46,7 +54,7 @@ jobs: sudo apt-get install -y git - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: submodules: 'True' @@ -74,7 +82,7 @@ jobs: tar czf ./kout.tgz "${{ github.workspace }}/build/klee/kout" - name: Upload Test Outputs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: kout.tgz path: ./kout.tgz diff --git a/.github/workflows/msvc.yaml b/.github/workflows/msvc.yaml index 43b9dba..5cbf81e 100644 --- a/.github/workflows/msvc.yaml +++ b/.github/workflows/msvc.yaml @@ -33,8 +33,13 @@ jobs: runs-on: windows-2019 steps: + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: submodules: 'True' @@ -57,13 +62,13 @@ jobs: # Upload SARIF file to GitHub Code Scanning Alerts - name: Upload SARIF to GitHub - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@0116bc2df50751f9724a2e35ef1f24d22f90e4e1 # v2.22.3 with: sarif_file: ${{ steps.run-analysis.outputs.sarif }} # Upload SARIF file as an Artifact to download and view - name: Upload SARIF as an Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: sarif-file path: ${{ steps.run-analysis.outputs.sarif }} diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml index 0bc0d6d..cd259a0 100644 --- a/.github/workflows/scorecard.yaml +++ b/.github/workflows/scorecard.yaml @@ -31,6 +31,11 @@ jobs: # actions: read steps: + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + - name: "Checkout code" uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 with: diff --git a/.github/workflows/sonarcloud.yaml b/.github/workflows/sonarcloud.yaml index fbeb864..de38edb 100644 --- a/.github/workflows/sonarcloud.yaml +++ b/.github/workflows/sonarcloud.yaml @@ -16,6 +16,11 @@ jobs: CLANG_VERSION: 14 steps: + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + - name: Install clang run: | if ! command -v "clang++-${{ env.CLANG_VERSION }}" @@ -28,7 +33,7 @@ jobs: sudo ./llvm.sh "$CLANG_VERSION" all fi - - uses: actions/checkout@v3 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis submodules: 'True' @@ -43,7 +48,7 @@ jobs: ninja-build - name: Install sonar-scanner and build-wrapper - uses: SonarSource/sonarcloud-github-c-cpp@v1 + uses: SonarSource/sonarcloud-github-c-cpp@8d08b4c506dc7a0601ad08b06f73fc9718cea84e # v1.3.2 - name: Configure build run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a24af8c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,22 @@ +repos: +- repo: https://github.com/gitleaks/gitleaks + rev: v8.16.3 + hooks: + - id: gitleaks +- repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 3.0.0 + hooks: + - id: shellcheck +- repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + hooks: + - id: cpplint +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/pylint-dev/pylint + rev: v2.17.2 + hooks: + - id: pylint