Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
When validating parsed JSON objects, schemas and other nested data structures in unit tests, order is typically not important. And yet I often find myself manually sorting the target structures when the internals of the tested function is modified such that order is changed. With this package, both the target and the actual structure can be recursively sorted before comparison.
Using poetry:
poetry add deep-sorted
Using pipenv:
pipenv install deep-sorted
Using pip:
pip install deep-sorted
from deep_sorted import deep_sorted
from datetime import datetime
one = {
"id": 9,
"name": "Ted Chiang",
"books": [
{
"id": 124,
"published": datetime(1991, 8, 1, 0, 0),
"title": "Understand",
"ratings": (6, 6, 3, 5, 6, 6, 0, 6, 0),
},
{
"id": 125,
"published": datetime(2019, 5, 7, 0, 0),
"title": "Exhalation",
},
],
}
two = {
"books": [
{
"published": datetime(2019, 5, 7, 0, 0),
"title": "Exhalation",
"id": 125,
},
{
"ratings": (3, 0, 0, 6, 6, 6, 6, 5, 6),
"id": 124,
"published": datetime(1991, 8, 1, 0, 0),
"title": "Understand",
},
],
"id": 9,
"name": "Ted Chiang",
}
assert deep_sorted(one) == deep_sorted(two)
FAQs
Sorting of nested dicts and lists
We found that deep-sorted 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.