Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
JSON fork-transforming tool
npm install --save jsonfork
Define the myfork
:
var jsonfork = require('jsonfork');
var myfork = new jsonfork({
name: 'Billing',
source: {
schema: {
"type": "object",
"properties": {
"title": { "type": "string" },
"fromTime": { "type": "string" },
"toTime": { "type": "string" },
"customerId": { "type": "string" },
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"label": { "type": "string" },
"price": { "type": "number" },
"amount": { "type": "number" }
},
"required": ["label", "price", "amount"]
}
}
}
}
},
targets: [{
name: 'Details',
transform: function(data) {
return {
title: data.title + ' [' + data.customerId + ']',
customerId: data.customerId,
items: data.items
}
},
eventName: 'BillingDetails'
},{
name: 'Summary',
transform: function(data) {
var summary = data.items.reduce(function(sum, item) {
sum.count += item.amount;
sum.total += item.amount * item.price;
return sum;
}, { count: 0, total: 0 });
return {
title: data.title + ' [' + data.customerId + ']',
customerId: data.customerId,
count: summary.count,
total: summary.total
}
},
schema: {}
}]
});
myfork.on(myfork.getOutputEventName('Details'), function(result) {
// save to database
console.log('Details (from event): %s', JSON.stringify(result));
});
myfork.on(myfork.getErrorEventName('Details'), function(result) {
// push error to log or enqueue
});
myfork.on(myfork.getOutputEventName('Summary'), function(result) {
// push to log or send back to webpage
console.log('Summary (from event): %s', JSON.stringify(result));
});
myfork.on(myfork.getErrorEventName('Summary'), function(result) {
// push error to log or enqueue
});
Use the myfork
:
var result = myfork.pushSync({
title: 'JsonFork Billing',
customerId: 'hello.com',
items: [
{ label: 'Item#1', price: 15, amount: 2 },
{ label: 'Item#2', price: 17, amount: 3 }
]
});
console.log('Result: %s', JSON.stringify(result, null, 2));
FAQs
JSON fork-transforming tool
We found that jsonfork 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.