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.
Biskviit is a lightweight cookie parser and serializer for Node.js. It allows you to easily handle HTTP cookies, including parsing cookie headers and creating cookie strings.
Parse Cookies
This feature allows you to parse a cookie header string into an object. The code sample demonstrates how to use Biskviit to parse a cookie string into a JavaScript object.
const Biskviit = require('biskviit');
const biskviit = new Biskviit();
const cookies = biskviit.parse('name=value; name2=value2');
console.log(cookies);
Create Cookie String
This feature allows you to create a cookie header string from an object. The code sample shows how to use Biskviit to convert a JavaScript object into a cookie string.
const Biskviit = require('biskviit');
const biskviit = new Biskviit();
const cookieString = biskviit.create({name: 'value', name2: 'value2'});
console.log(cookieString);
Set Cookie
This feature allows you to set a cookie with various options such as expiration time. The code sample demonstrates how to set a cookie with an expiration time using Biskviit.
const Biskviit = require('biskviit');
const biskviit = new Biskviit();
biskviit.set('name', 'value', {expires: new Date(Date.now() + 3600 * 1000)});
console.log(biskviit.cookies);
The 'cookie' package is a simple, lightweight library for parsing and serializing cookies. It provides similar functionality to Biskviit but is more widely used and has a larger community. It is also maintained by the same team that maintains the popular 'express' framework.
The 'cookies' package is another alternative that provides a more comprehensive API for handling cookies in Node.js. It supports both parsing and setting cookies, and it integrates well with the 'http' and 'https' modules. It is more feature-rich compared to Biskviit.
The 'tough-cookie' package is a robust cookie management library that supports the full RFC 6265 spec. It is more advanced than Biskviit and is suitable for applications that require strict adherence to cookie standards and more complex cookie management features.
Yet another node module for handling http cookies. This module parses Set-Cookie
header, stores the data to memory and returns valid value for Cookie
header once needed based on the stored cookie data.
Install from npm
npm install biskviit --save
Require as Biskviit
var Biskviit = require('biskviit');
Create a cookie managing biskviit instance
var biskviit = new Biskviit(options);
Where
Example
var Biskviit = require('biskviit');
var biskviit = new Biskviit({
sessionTimeout: 5 * 60 // expire cookies after 5 minutes
});
To add new cookies to the storage use set
biskviit.set(cookieString, url)
Where
Set-Cookie:
headerExample
biskviit.set('theme=light', 'http://example.com/');
biskviit.set('sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT', 'http://example.com/');
To list all available cookies for a specified URL use get
var cookiesString = biskviit.get(url);
Where
Example
var cookiesString = biskviit.get('http://example.com/');
// theme=light; sessionToken=abc123
If you need to filter cookies as objects, use list
var cookiesString = biskviit.list(url);
Where
Example
var cookiesString = biskviit.list('http://example.com/');
// [{key: 'theme', value: 'light', expires: ...}, {key: 'sessionToken', value: 'abc123', expires: ...}]
MIT
FAQs
Yet another module for http cookie handling
We found that biskviit 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.