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.
:mag: Transparent query, pointer and path descriptors for JSON
json-where
converges the following standards and libraries in order to help normalize JSON query/addressing descriptors:
The goal is to increase developer transparency and to provide a unified interface for matching related JSON data.
json-where
's simple interface spares developers from having to:
npm install json-where
This example shows how to use the main feature of json-where
, which is being able to provide any descriptor string to $
.
The $
"operator" will automatically imply the correct specification to use based on the descriptor itself:
import $ from 'json-where'
const data = {
foo: {
bar: 'baz'
}
}
let query = $('foo.bar').use(data).get() // 'baz'
let path = $('$.foo.bar').use(data).get() // 'baz'
let pointer = $('/foo/bar').use(data).get() // 'baz'
If you want to be slightly more concise you can avoid calling use
:
let query = $('foo[bar]', data).get() // 'baz'
let path = $('$.foo.bar', data).get() // 'baz'
let pointer = $('/foo/bar', data).get() // 'baz'
You may also, of course, access and use each specification individually:
import { query, path, pointer } from 'json-where'
query('foo[bar]', data).get() // 'baz'
path('$.foo.bar', data).get() // 'baz'
pointer('/foo/bar', data).get() // 'baz'
You can easily specify whether or not you should expect a single object or a collection:
$('foo[bar]', data).one() // 'baz'
$('foo[bar]', data).all() // ['baz']
A couple of common utility methods are also defined for working with collections:
$('foo[bar]', data).count() // 1
$('foo[bar]', data).any() // true
$('bar[baz]', data).any() // false
You can infer the specification directly from the descriptor itself via which
:
which('foo[bar]') // 'json-query'
which('$.foo.bar') // 'json-path'
which('/foo/bar') // 'json-pointer'
Currently only json-pointer
supports updating values via descriptors:
const path = pointer('/foo/bar', data)
path.get() // 'bar'
path.set('zab') // ...
path.get() // 'zab'
FAQs
Transparent query, pointer and path descriptors for JSON
The npm package json-where receives a total of 14 weekly downloads. As such, json-where popularity was classified as not popular.
We found that json-where demonstrated a not healthy version release cadence and project activity because the last version was released 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.