-
Notifications
You must be signed in to change notification settings - Fork 37
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
Support custom mypy path #95
Comments
This is in no way hardcoded. These lines just mean "pick whatever If you can propose a way to make it configurable, that does not present a significant security risk, I am open to it. |
I have multiple Python projects to work on, where each project have distinct configurations:
Technically it is possible to switch PATH using something like direnv, but it becomes quickly cumbersome to do so in Zed, Neovim, VSCode, etc. |
Also, the sibling ruff plugin support the custom executable path as mentioned in the PR. Why not adding this? 😉 |
Another plugin having a security issue does not compel me to include one in mine. The newest commit contains an option how you can risk your computer without endangering others. |
@Richardk2n Hm... Could you elaborate concrete scenarios that having a customizable Python tool executable path becomes a security issue? For instance, are you concerned with CI executions in public repositories where people can send malicious PRs that modifies the configuration? If so, I think the same could still happen with the PATH environment variable by modifying CI configurations or adding additional scripts, etc. in the PRs. I don't get the difference between PATH env-var based customization and the config-based customization in the perspective of security. AFAIK, GitHub offers an option to "approve the run of CI" for PRs from unforeseen people as a mitigation and I'm pretty sure other open-source collaboration tools provide similar options. Wouldn't this be sufficient? |
I would not expect anyone to use this in CI. Still a PR attack is theoretically possible. But modifying the CI config is probably a lot more suspicious than a config file. This is not the scenario I had in mind. What I am thinking about is the scenario of you just cloned a repo and have opened it in your IDE to look at the code. With this feature, you have just given the repo execute permission on your system. In case of an untrustworthy repo (or a malicious maintainer), merely looking at the code can lead to malicious code being executed. |
Thanks for the detailed explanation. Now I get the point. What I'm trying to achieve is to configure my shiny new Zed editor with pylsp working with a mypy in custom location like The problem is:
I thought the simplest solution is just to set a specific location of the mypy executable in the per-project configuration in e.g., https://docs.backend.ai/en/latest/dev/daily-workflows.html#vim-neovim It seems that other LSP-capable editors like VSCode and NeoVim have similar issues and often just offers a way to add a local private configuration to customize Python tool executable locations in LSP configurations. I think that's why VSCode enters the restricted mode when opening a new, unforeseen filesystem location. (If all LSP-capable editors provides this feature, then would you agree with my addition? Maybe, this restricted-mode behavior should be included in the LSP specification....) Could you suggest me a good secure alternative in this case? How would you configure your IDE/editor in such case? |
The challenge here is that it would be ideal if all LSP-capable editors have the restricted mode for the concerned scenario. Unfortunately, not all editors in the reality have such feature and it prevents me from trying those new editors even at my own risk and supervision. 😞 |
In a monorepo setting using Pantsbuild, various Python tools are installed in separate virtaulenvs like:
dist/export/python/virtualenvs/mypy/3.12.6/bin/mypy
dist/export/python/virtualenvs/ruff/3.12.6/bin/ruff
while the main source tree looks at (while it is also possible to have per-subdir lock files):
dist/export/python/virtualenvs/python-default/3.12.6/bin/python
I can override the
--python-executable
argument passed to mypy for the main virtualenv, but I cannot override themypy
executable path itself.It seems to be hardcoded here:
pylsp-mypy/pylsp_mypy/plugin.py
Lines 307 to 313 in 9be427d
Could we make it something configurable?
The text was updated successfully, but these errors were encountered: