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

Needless call to eval in setup.py #318

Closed
moltenform opened this issue Jun 4, 2024 · 3 comments
Closed

Needless call to eval in setup.py #318

moltenform opened this issue Jun 4, 2024 · 3 comments

Comments

@moltenform
Copy link
Contributor

moltenform commented Jun 4, 2024

I prefer to get rid of calls to eval for security reasons,

Especially in a setup.py file where one wouldn't expect code to run just by importing the file.

If someone malicious were to make a file in the right place they could get an arbitrary line of code to run.

Let's see if we can change the line

 if line.startswith("__version__ ="):
            version = eval(line.split("=", 1)[1])
            break

to

 if line.startswith("__version__ ="):
            version = line.split("=", 1)
            version = version.replace('"', '').replace("'", '')
            version = version.strip()
            break
@skorokithakis
Copy link
Collaborator

No reason why we can't, would you like to submit a PR?

@moltenform
Copy link
Contributor Author

Thanks!

@skorokithakis
Copy link
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants