
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Percento.js
is designed to be Handlebars for JSON.
It is a node module that allows you to template JSON objects with mixins that can be resolved with a context by this package. Mixins are defined using delimiters, the default ones are %...%
.
For example, given the following JSON object (template)
{
"Jason": [
"%actor%",
"%murderer%",
"%singer%"
]
}
And a context of
{
singer: "Mraz",
actor: "Statham",
murderer: "Voorhees"
}
Percento.js
will produce the following
{
"Jason": [
"Statham",
"Voorhees",
"Mraz"
]
}
To install this package to your project, run
npm install --save percento
Then require it and use it with
var percento = require('percento');
percento().resolve(json, ctx);
Percento returns the modified string, so you will have to assign it to a variable.
Percento.js
can be configured with a custom delimiter, or pair of opening and closing delimiters to define your own matchers.
percento({delimiter: '$$'}).resolve(template, ctx);
percento({delimiter: {first: '{{', last: '}}'}}).resolve(template, ctx);
You can chain resolutions calls together in the following manner
percento().chain().resolve(template, ctx1).resolve(ctx2).resolve(ctx3).value();
Chaining passes the resolved template through to each subsequent resolve
call. You must call .value()
at the end to return the current resolved template.
Templates can access nested properties of a context, for example this JSON object
{
"name": "%people[0].name%",
"surname": "%people[1].surname%"
}
Can access the properties in this context
{
people:[
{ name: "Juliet", surname: "Capulet" },
{ name: "Romeo", surname: "Montague" }
]
}
To pick the values "Juliet"
and "Montague"
.
This uses lodash
's deep get method, so the accessor string in the template should behave the same way.
Calling percento
with a single argument will try to resolve all mixins using itself as the context, for example
var template = {
name: "william",
surname: "shakespeare",
fullname: "%name% %surname%"
}
var result = percento().resolve(template);
result.fullname; // william shakespeare
FAQs
Simple node package to mixin json variables
The npm package percento receives a total of 1 weekly downloads. As such, percento popularity was classified as not popular.
We found that percento demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.