Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
flake8-assert-finder
Advanced tools
A simple flake8 Plugin that checks if assert is used
The assert
Keyword is very useful in Python, but has one big problem: Python has a optimized mode. When using this, The assert
Keyword will no longer work, so if you use assert
in a Library, this can lead to Problems.
You should replace assert with this little function:
def assert_func(expression: bool) -> None:
"""
The assert keyword is not available when running Python in optimized mode.
This function is a drop-in replacement.
See https://docs.python.org/3/using/cmdline.html?highlight=pythonoptimize#cmdoption-O
"""
if not expression:
raise AssertionError()
This makes sure, your will be working.
If you just write your own Program, which you don't use with the optimized mode or if you use something like pytest, you can use assert
of course.
This Plugin just checks for the use of the assert
Keyword. Nothing more.
ID | Description |
---|---|
AF100 | Found assert |
FAQs
A simple flake8 Plugin that checks if assert is used
We found that flake8-assert-finder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.