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

Invalid parameter "--pess" when installed via pipx #171

Closed
ndkirillov opened this issue Jun 13, 2024 · 5 comments
Closed

Invalid parameter "--pess" when installed via pipx #171

ndkirillov opened this issue Jun 13, 2024 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ndkirillov
Copy link
Collaborator

Received a message in Slitherin telegram chat:

When installing Slitherin with pipx and running it --pess mode, it seems that the base slither package doesnt recognize slitherin detectors. Running slither and slitherin in --slither mode both run normally (when install with pipx)

https://gist.github.com/vile/b555c40d1acb083c896830727570605c

For my exact environment, im on WSL using ubuntu, installing with pipx using pyenv (3.11) shim(s), in a default foundry project.

@ndkirillov ndkirillov added the bug Something isn't working label Jun 13, 2024
@vile
Copy link
Contributor

vile commented Jun 13, 2024

Thanks for creating this issue. The title is a little misleading, running slitherin . --pess is an accepted command both in pip and pipx; the real issue stems from the base slither package not recognizing (or knowing how to recognize), custom detectors. I suspect this is a weird shared-library issue stemming from pipx itself (https://pipx.pypa.io/stable/how-pipx-works/). It should be noted you must install slither seperately as a pre-req when using pipx, just like a normal pip installation. Even thought it is fully independently installed in slitherin's .local venv (see: https://prnt.sc/n9d4je9JZnpx).

And just to make it clear:

WORKS:

slither .
slitherin . # Essentially short-hand for `--slither` -- Edit: this is not a short-hand, but for some reason only ran default slither detectors during this time
slitherin . --slither

DOES NOT WORK:

slitherin . --pess

In my gist (above), L12-L16 seems to be where the issue stems from, raise ValueError(f"Error: {detector} is not a detector"). Again, I believe this is an issue specifically with pipx, if you look at the path in the trace, slither is being invokved from its own .local venv, meaning that it doesn't know where the custom dectors are (or maybe it does know, but its only recieveing a relative path?).

Is there maybe someway to invoke "local" (relative) slither (ie, bundled with slitherin), or specify a path to slither for custom detectors via cli?

@vile
Copy link
Contributor

vile commented Jun 13, 2024

Okay, after some testing, this is 100% a weird pipx issue.

I am able to run slitherin successfully if i invoke the executable directly from the pipx venv AND append slitherin's bin to PATH (temporarily). This also prevents the need for an independent slither install (in my project, running pipx list, ONLY slitherin is installed: https://prnt.sc/VXywi6GkkFjh). As mentioned previously, slither is installed in slitherin's .local venv (see: https://prnt.sc/z0xb0YAN0qLl).

Here is the command:

PATH="$PATH:/home/fantasy/.local/pipx/venvs/slitherin/bin"; slitherin . --pess

Replace /home/fantasy with whatever your home and linux user is. And run in any project (in my case, using foundry).

@vile
Copy link
Contributor

vile commented Jun 14, 2024

Without having to make actual code changes, the README could be updated to simply include a line/section about installing with pipx to specify to include slitherin's bin in PATH using the following one-liner:

echo -e "# Slitherin with pipx\nexport PATH=\"\$PATH:/home/$USER/.local/pipx/venvs/slitherin/bin\"\n" >> ~/.bashrc \
&& source ~/.bashrc

@ndkirillov
Copy link
Collaborator Author

@vile, appreciate your research! Your PR is merged into the develop branch. We'll include your updates into the next release!

@ndkirillov ndkirillov added this to the 0.7.2 version milestone Jun 19, 2024
@ndkirillov
Copy link
Collaborator Author

Merged into master with #179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants