
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
#Cuddle
Cuddle is a minimal, chainable, retryable and "readability first" node http client. It's built to use for calling third-party APIs. Just what you need.
npm install cuddle --save
##Use Cases
###Simple
const cudl = require('cuddle');
cudl.post
.to('http://localhost:8082/api/user/1')
.set_header('Authorization', 'Token sampletoken')
.send({
username: 'rvnjl',
sex: 'male'
})
.then((err, result) => {
if (err) {
//handle error
}
console.log(result);
});
###Promise:
const cudl = require('cuddle');
cudl.post
.to('http://localhost:8082/api/user/1')
.set_header('Authorization', 'Token sampletoken')
.send({
username: 'rvnjl',
sex: 'male'
})
.promise()
.then(success)
.catch(fail);
###Using with generators:
const cudl = require('cuddle');
const co = require('co');
function* foo () {
let user = yield cudl.get
.to('http://localhost:8082/api/user/1')
.set_header('Authorization', 'Token sampletoken')
.promise();
console.log(user);
}
co(foo);
###Throttling requests
// will only let 50 concurrent requests
cudl.throttle(50);
###Easy scoping through args:
const cudl = require('cuddle');
function foo () {
const users = [
{id: 1, name: 'jeff'},
{id: 2, name: 'jenny'},
{id: 3, name: 'julius'}
];
users.forEach(user => {
cudl.get
.to('http://localhost:8082/api/user/' + user.id)
.args(user)
//.max_retry(10) // default is 3
//.debug() // if you want to log all
//.logger(winston) // if you want to replace the logger (console)
.then(bar);
});
}
function bar (err, result, request, args) {
const user = args[0];
if (err) {
// cuddle will return a different error after reaching maximum retries
if (err.code >= 500) {
return request.retry();
}
console.error('Error with user ' + user.id + request);
return;
}
user.more_info = result;
// ...
}
foo();
Status code < 200 or >= 300 will be classifed as an error.
##Migrating from version <= 0.0.56
add_header
is now set_header
FAQs
Cuddle is a minimal, chainable and readability first http client
The npm package cuddle receives a total of 57 weekly downloads. As such, cuddle popularity was classified as not popular.
We found that cuddle 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.