Skip to content

Commit

Permalink
feat: add slither
Browse files Browse the repository at this point in the history
  • Loading branch information
eshaan-deepsource committed Oct 31, 2023
1 parent 201af0d commit 72254c3
Show file tree
Hide file tree
Showing 95 changed files with 142 additions and 93 deletions.
49 changes: 49 additions & 0 deletions analyzers/slither/CI/github-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ref: https://github.com/crytic/slither-action#how-to-use-1
# A copy-paste Github Actions config to run Slither and report the artifact to DeepSource
name: Slither Analysis

on:
# Note that both `push` and `pull_request` triggers should be present for GitHub to consistently present slither
# SARIF reports.
push:
branches: [ main, master ]
pull_request:

jobs:
scan:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
# The following is the latest version of slither-analyzer supported by DeepSource
slither-version: 0.10.0
# The following makes slither produce scan analysis in SARIF format
sarif: ./slither.sarif
# required to let the SARIF upload step run even if Slither finds issues
continue-on-error: true

- name: Upload SARIF report files to DeepSource
run: |
# Install the CLI
curl https://deepsource.io/cli | sh
# Send the report to DeepSource
./bin/deepsource report --analyzer slither --value-file ${{ steps.slither.outputs.sarif }}
# Ensure the workflow eventually fails if files did not pass slither checks.
- name: Verify slither-action succeeded
shell: bash
run: |
echo "If this step fails, slither found issues. Check the output of the scan step above."
[[ "${{ steps.slither.outcome }}" == "success" ]]
2 changes: 1 addition & 1 deletion analyzers/slither/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# path to the `issue_map.json` located in the same directory as this script
ISSUE_MAP_FILE = os.path.join(os.path.dirname(__file__), "issue_map.json")
ISSUE_PREFIX = "SLITHER-D"
ISSUE_PREFIX = "SLITHER-W"
ZEROES_PADDING_LENGTH = 4


Expand Down
Loading

0 comments on commit 72254c3

Please sign in to comment.