-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
audit: check for Python-wide site-package usage #16663
Conversation
This needs an allowlist and further testing. It's just an early draft to see if this audit would make sense to enforce our vendoring policy. Note: I am aware that the existing check_easy_install_pth check looks fishy nowadays, and will handle that in a separate pull request. |
Seems like it would catch a ton of things that happen to ship Python bindings which we have always allowed, unless we're planning on changing that? Limiting this to |
Don't think we should change that 👍🏻 Could maybe do something like always allow that if there's also something anything |
Done |
I made an attempt to parse for .so files (will need to adapt for .dylib on Linux too). The only remaining exception I am aware of is |
I opened another (unrelated) PR for the check_easy_install_pth check: |
See Homebrew#16662 We would like to enforce vendoring for Python libraries, or the usage of a virtualenv in the formula's libexec directory, using a virtualenv.
Made some tests with the current implementation. These are ok:
These are not:
|
@@ -143,6 +143,25 @@ | |||
EOS | |||
end | |||
|
|||
def check_global_site_package_usage(formula) | |||
return unless formula.tap.core_tap? | |||
return unless formula.stable.url.start_with?("https://files.pythonhosted.org") |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
https://files.pythonhosted.org
I don't think so - it's a CLI tool that is installed under a virtualenv rather than directly to site-packages. I do realise some dependents try to bypass that though and perhaps shouldn't. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
See #16662
We would like to enforce vendoring for Python libraries, or the usage of a virtualenv in the formula's libexec directory, using a virtualenv.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?