From b0fbc164bf7f7dd46b0c27ce99d34fa1af4b3c55 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 10 Jul 2024 17:48:37 +0200 Subject: [PATCH] ci: add slither static analysis (#211) Co-authored-by: Francisco de Borja Aranda Castillejo --- .github/workflows/coverage.yaml | 2 +- .github/workflows/slither.yaml | 50 +++++++++++++++++++++++++++++++++ slither.config.json | 7 +++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/slither.yaml create mode 100644 slither.config.json diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index b555771b..f3a1550a 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -1,4 +1,4 @@ -name: Test +name: Coverage on: push: diff --git a/.github/workflows/slither.yaml b/.github/workflows/slither.yaml new file mode 100644 index 00000000..d7a266f2 --- /dev/null +++ b/.github/workflows/slither.yaml @@ -0,0 +1,50 @@ +name: Slither + +on: + push: + branches: + - main + pull_request: + branches: + - "*" + types: + - synchronize + - opened + - reopened + - ready_for_review + +jobs: + slither: + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version: "18" + + - name: Install Dependencies + run: yarn install + + - name: Compile contracts + run: yarn compile + + - name: Run Slither + uses: crytic/slither-action@main + id: slither + continue-on-error: true + with: + sarif: results.sarifs + node-version: "18" + fail-on: none + + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: ${{ steps.slither.outputs.sarif }} diff --git a/slither.config.json b/slither.config.json new file mode 100644 index 00000000..4d277b69 --- /dev/null +++ b/slither.config.json @@ -0,0 +1,7 @@ +{ + "detectors_to_exclude": "", + "compile_force_framework": "hardhat", + "hardhat_ignore_compile": true, + "npx_disable": true, + "filter_paths": "artifacts,cache,data,dist,docs,lib,node_modules,pkg,scripts,tasks,test,testing,typechain-types" +}