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.
@swimlane/obfuscator
Advanced tools
🗝 Obfuscate values based on JSON Schemas
By default, Obfuscator will replace any values defined in the schema of type password
with **********
.
import { Obfuscator } from '@swimlane/obfuscator';
const obj = {
foo: 'bar',
fizz: 'buzz'
};
const schema = {
type: 'object',
properties: {
foo: {
type: 'password'
},
fizz: {
type: 'string'
}
}
};
console.log(Obfuscator.value(obj, schema));
// {
// "foo": "**********",
// "fizz": "buzz"
// }
This function will obfuscate a value based on a JSON schema provided.
**********
. It can be a:
'[ REDACTED ]'
)(value, key)
and returns a string. This is useful if you want to obfuscate differently based on the value of key name. (ex. (value, key) => 'REDACTED ' + value.length
)['password']
A little helper function to try and unobfuscate a value based on its previous value. The usage here is when updating an obfuscated object, you can save the new object with the unobfuscated values (assuming you have access to them)
**********
import { Obfuscate } from '@swimlane/obfuscator';
async function update(newValue): Promise<void> {
// get previous value from DB or something
const previous = await yourRepo.findById(newValue.id);
//replace any obfuscated values with their DB version
const updatedAsset = Obfuscator.unObfuscate(newValue, previous);
// Save new version with unobfuscated value
const result = await yourRepo.save(updatedAsset);
}
See tests/Obfuscator.spec.ts
for various examples of usage.
Obfuscator is a Swimlane open-source project; we believe in giving back to the open-source community by sharing some of the projects we build for our application. Swimlane is an automated cyber security operations and incident response platform that enables cyber security teams to leverage threat intelligence, speed up incident response and automate security operations.
FAQs
Obfuscate objects based on a JSON Schema
We found that @swimlane/obfuscator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 34 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.