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.
A short way to check for conditions and raise if it fails, in Python.
I get annoyed to need writing all the time variations around:
if not isinstance(my_bool, bool):
raise ValueError("my_bool should be a bool")
And as pointed several places on the net, assert
cannot really be trusted for performing this sort of checks, as asserts can be disabled with the -O
flag, see for example: https://stackoverflow.com/questions/1273211/disable-assertions-in-python .
The raise_assert package contains a single function that allows writing:
from raise_assert import ras
ras(isinstance(my_bool, bool))
or, if you want an error message (but this is usually not needed, as the stack trace is usually explicit enough):
from raise_assert import ras
ras(isinstance(my_bool, bool), "my_bool must be a bool")
pip install raise_assert
The word ras
is shortland for both raise_assert and 'rien à signaler', 'nothing to signal' in French.
FAQs
an alternative to assert - guaranteed to raise
We found that raise-assert 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.