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.
Replace UUIDs in your JSON files and JS objects with new UUIDs while preserving references.
json-cloak
provides a command-line interface for transforming JSON files, as well as a function to use in JavaScript projects to transform individual JS objects. Identical UUIDs are replaced with the same UUID.
The simplest way to use json-cloak
is to invoke via npx
:
npx json-cloak [options]
Alternatively, you can install json-cloak
globally as a CLI:
# npm
npm install -g json-cloak
# yarn
yarn global add json-cloak
Note: The npm package name is json-cloak
, however the globally installed binary name is just cloak
cloak [options]
-f, --file
: Specify the JSON file to transform.-i, --in-place
: Update the file in place with the transformed JSON object.-k, --keys
: Display the replaced keys instead of printing the transformed JSON object.-v, --version
: Display the version number.-p, --pattern
: Specify a glob pattern to operate on multiple files. This will perform updates in place!-q, --quiet
: Don't print to stdout-h, --help
: Show the help message.cloak -i -f data.json
cloak -k -f data.json
cloak -p 'test/*.json' -f other/dir/foo.json
cloak -v
In addition to being used as a CLI, json-cloak
can also be used inside JavaScript projects to transform individual JSON objects. Use either as CommonJS or ES6 module.
npm install json-cloak
or
yarn add json-cloak
// CommonJS
// const { cloak } = require('json-cloak')
// ES6
import { cloak } from 'json-cloak'
const user = {
id: 'a025c322-78af-4a23-8c27-e05a42be620e',
name: 'Javier',
age: 30,
friends: [
{
id: '80b96ced-ad77-4a9a-b758-a04e5988d093',
name: 'Sam',
age: 35,
friends: [
{
id: 'a025c322-78af-4a23-8c27-e05a42be620e',
name: 'Javier',
age: 30,
}
]
}
]
}
const transformedObject = cloak(user)
console.log(JSON.stringify(transformedObject, null, 2))
// {
// "id": "08cb9bb4-65b4-4706-88ef-97f97d208b37",
// "name": "Javier",
// "age": 30,
// "friends": [
// {
// "id": "6864205d-fcb2-49be-9c97-133379670e1a",
// "name": "Sam",
// "age": 35,
// "friends": [
// {
// "id": "08cb9bb4-65b4-4706-88ef-97f97d208b37",
// "name": "Javier",
// "age": 30
// }
// ]
// }
// ]
// }
Contributions are welcome, please open an issue or submit a pull request!
FAQs
Replace UUIDs in your JSON files
The npm package json-cloak receives a total of 0 weekly downloads. As such, json-cloak popularity was classified as not popular.
We found that json-cloak 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.