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.
jsonpath-rust-bindings
Advanced tools
This package contains Python bindings for jsonpath-rust library by besok.
The details regarding the JsonPath itself can be found here.
pip install jsonpath-rust-bindings
from jsonpath_rust_bindings import Finder
sample = {
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95,
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99,
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99,
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99,
},
],
"bicycle": {"color": "red", "price": 19.95},
},
"expensive": 10,
}
queries = [
'$.store.book[*].author',
'$..book[?(@.isbn)]',
'$.store.*',
'$..author',
'$.store..price',
'$..book[2]',
# '$..book[-2]',
'$..book[0,1]',
'$..book[:2]',
'$..book[1:2]',
'$..book[-2:]',
'$..book[2:]',
'$.store.book[?(@.price<10)]',
'$..book[?(@.price<=$.expensive)]',
"$..book[?(@.author ~= '.*Rees')].price",
'$..*',
]
f = Finder(sample)
for query in queries:
print(query, f.find(query), '\n')
# You will see a bunch of found items like
# $..book[?(@.author ~= '.*Rees')].price [JsonPathResult(data=8.95, path=Some("$.['store'].['book'][0].['price']"), is_new_value=False)]
JsonPathResult
has the following attributes:
JsonPathResult
can't be constructed from Python; it is only returned by Finder.find()
.
The current implementation is cloning the original PyObject
data when converting it to the serde Value
.
It happens each time you're creating a new Finder
instance. Try to reuse the same Finder
instance for querying if it's possible.
Also, It has yet another consequence demonstrated in the following example:
>>> original_object_i_want_to_mutate = {'a': {'b': 'sample b'}}
>>> from jsonpath_rust_bindings import Finder
>>> f = Finder(original_object_i_want_to_mutate)
>>> b_dict = f.find('$.a')[0].data
>>> b_dict
{'b': 'sample b'}
>>> b_dict['new'] = 42
>>> original_object_i_want_to_mutate
{'a': {'b': 'sample b'}}
FAQs
Unknown package
We found that jsonpath-rust-bindings 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.