
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
cookie-dough
Advanced tools
An isomorphic JavaScript cookie library.
Wraps https://www.npmjs.com/package/cookie to work on the client and server. Also, required is having parsed cookies in express (for now).
// client-side
// automatically parses the cookies for the page
var cookie = require('cookie-dough')();
cookie.get('name');
// server-side
var express = require('express'),
CookieDough = require('cookie-dough'),
cookieParser = require('cookie-parser');
var app = express();
app.use(cookieParser());
app.get('/', function(req, res){
var cookie = new CookieDough(req); // req is required when creating an instance
cookie.get('name');
});
// client-side
// automatically parses the cookies for the page
var cookie = require('cookie-dough')();
// returns an object with all of the cookies
// format: { cookieName: "cookie value" }
cookie.all();
// server-side
var express = require('express'),
CookieDough = require('cookie-dough'),
cookieParser = require('cookie-parser');
var app = express();
app.use(cookieParser());
app.get('/', function(req, res){
var cookie = new CookieDough(req);
cookie.all();
});
// client-side
var cookie = require('cookie-dough')();
cookie.set('name', 'value', { /* options */ });
// server-side
var express = require('express'),
CookieDough = require('cookie-dough'),
cookieParser = require('cookie-parser');
var app = express();
app.use(cookieParser());
app.get('/', function(req, res){
var cookie = new CookieDough(req);
cookie.set('name', 'value', { /* options */ });
});
The options that you can set on a cookie:
path - cookie path
expires - absolute expiration date for the cookie (Date object)
maxAge - relative max age of the cookie from when the client receives it (seconds)
domain - domain for the cookie
secure - true or false
httpOnly - true or false
// client-side
var cookie = require('cookie-dough')();
cookie.remove('name', { /* options */ });
// server-side
var express = require('express'),
CookieDough = require('cookie-dough'),
cookieParser = require('cookie-parser');
var app = express();
app.use(cookieParser());
app.get('/', function(req, res){
var cookie = new CookieDough(req);
cookie.remove('name');
});
The options that can be set to remove a cookie are:
path - cookie path
domain - domain for the cookie
FAQs
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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.