Skip to content

Commit

Permalink
Add a way to install Slither plugins
Browse files Browse the repository at this point in the history
This adds an extra option, `slither-plugins`, that lets users provide
a requirements.txt file to be installed alongside Slither. This can
be used to install Slither plugins.

Fixes: #16
  • Loading branch information
elopez committed Apr 19, 2024
1 parent 0328f2f commit a28260c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ inputs:
description: 'The path to the Slither configuration file. By default, `./slither.config.json` is used if present.'
slither-version:
description: 'The version of slither-analyzer to use. By default, the latest release in PyPI is used.'
slither-plugins:
description: 'A requirements.txt file to install alongside Slither. Useful to install custom plugins.'
ignore-compile:
description: 'Whether to ignore the compilation step when running crytic-compile and Slither.'
default: false
Expand Down
8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ SARIFOUT="$4"
SLITHERVER="$5"
SLITHERARGS="$(get INPUT_SLITHER-ARGS)"
SLITHERCONF="$(get INPUT_SLITHER-CONFIG)"
SLITHERPLUGINS="$(get INPUT_SLITHER-PLUGINS)"
STDOUTFILE="/tmp/slither-stdout"
IGNORECOMPILE="$(get INPUT_IGNORE-COMPILE)"

Expand Down Expand Up @@ -185,6 +186,13 @@ install_slither()
export PATH="/opt/slither/bin:$PATH"
pip3 install wheel
pip3 install "$SLITHERPKG"

if [[ -n "$SLITHERPLUGINS" ]]; then
echo "[-] Slither plugins provided, installing them"
pushd "$(dirname "$SLITHERPLUGINS")" >/dev/null
pip3 install -r "$(basename "$SLITHERPLUGINS")"
popd >/dev/null
fi
}

install_deps()
Expand Down

0 comments on commit a28260c

Please sign in to comment.