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 library of utility functions for coputing diffs between tree-like data structures.
A library of utility functions for computing diffs between tree-like data structures.
pip install treediffer
Given studio tree JSON-archive versions of the maintree
and the stagingtree
of a Studio channel generated using ./contentcuration/manage.py archivechannel ...
,
you can compute the tree diff between them using:
>>> from treediffer import treediff
>>> diff = treediff(maintree, stagingtree, preset="studio", format="simplified")
>>> diff
{
"nodes_deleted": [...], # content_ids gone in stagingtree
"nodes_added": [...], # new content_ids in stagingtree
"nodes_moved": [...], # same content_id but different node_id
"nodes_modified": [...], # same node_id, but changes in node attributes
}
This code examples uses the "high level" API based on the studio preset that set
all the necessary lookups (node_id, content_id, parent, assetment_items, etc.)
so the diffing logic will work. See examples/studiodiffferpoc.py
for full script.
See examples/ricecookerdiffpoc.py
for similar script that diffs ricecooker trees
that get saved in chefdata/trees/
dir after each content integration script runs.
Use format="restructured"
to post-process the simplified diff and group additions
and deletions into logical subtrees (e.g. if whole topic is deleted, show as subtree).
This is the default when printing on command line as in the example scripts.
Use format="raw"
to see the diff before simplification and move detection (for debugging).
pytest
and
pytest --cov=src/treediffer tests/
Visit https://treediffer.readthedocs.io/ for more info about how this works In particular see https://treediffer.readthedocs.io/en/latest/diff_formats.html for the the details about the structure of the diffs produced and https://treediffer.readthedocs.io/en/latest/design.html for API advanced usage.
FAQs
A library of utility functions for coputing diffs between tree-like data structures.
We found that treediffer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.