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.
var jeyson = require('jeyson').create(),
scope = {message: 'Hello!'},
templateJson = {"message": "{{message}}"},
compiled = jeyson.compile(scope, templateJson);
An expression is defined as '{{expr}}'
Following template.json :
{
"age": "{{21 + 33}}"
}
is compiled to
{
"age": 54
}
Any valid javascript snippet is a valid expression, e.g following template.json :
{
"list" : "{{'one,two,three,four,five'.split(',')}}",
}
is compiled to
{
"list" : ["one", "two", "three", "four", "five"],
}
Any field on scope object, is available as local variable in expressions.
e.g. Given scope defined as :
var scope = {message: "Hello !"},
then following template.json :
{
"message": "{{message}}"
}
is compiled to
{
"message": "Hello !"
}
e.g. Given scope defined as :
var scope = {
message: function(){
return "Hello !";
}
};
then following template.json :
{
"message": "{{message()}}"
}
is compiled to
{
"message": "Hello !"
}
E.g.
{
"list" : {
"@repeat" : "name in ['one','two','three','four','five']",
"id" : "{{$index + 1}}",
"name" : "{{name}}",
}
}
It will compile to following json :
{
"list": [ {"id": "1","name" : "one"},
{"id": "2","name" : "two"},
{"id": "3","name" : "three"},
{"id": "4","name" : "four"},
{"id": "5","name" : "five"}];
}
Following are the conditional directives
scope = {role : {name: "admin"}}
template = {
"user" : {
"role" : {
"@switch" : "role.name",
"@admin" : {"name" : "admin"},
"@visitor" : {"name" : "visitor"},
"@default" : {"name" : "guest"}
}
}
Will compile to
template = {
"user" : {
"role" : {"name" : "admin"}
}
{
"author" : "ABC",
"book" : {
"@if" : "1 == 2",
"@then" : {"title" : "Harry Potter"}
"@else" : "unknown",
}
}
will result in
{
"author" : "ABC",
"book" : "unknown"
}
{
"author" : "ABC",
"book" : {
"@if" : "1 == 1",
"@then" : {"title" : "Harry Potter"}
}
will result in
{
"author" : "ABC",
"book" : {"title" : "Harry Potter"}
}
{
"author" : "ABC",
"book" : {
"@if" : "1 == 2",
"@then" : {"title" : "Harry Potter"}
}
will result in
{
"author" : "ABC",
"book" : null
}
e.g
{
"author" : "ABC",
"book" : {
"@ignore-if": "1 == 1",
"title" : "Harry Potter"
}
}
will result in
{
"author" : "ABC"
}
Inbuilt directives for repeating, including other json etc.
FAQs
Json template engine
We found that jeyson 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.