
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@types/cookie-parser
Advanced tools
TypeScript definitions for cookie-parser
npm install --save @types/cookie-parser
This package contains type definitions for cookie-parser (https://github.com/expressjs/cookie-parser).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie-parser.
import express = require("express");
declare module "express" {
// Inject additional properties on express.Request
interface Request {
/**
* This request's secret.
* Optionally set by cookie-parser if secret(s) are provided. Can be used by other middleware.
* [Declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to add your own properties.
*/
secret?: string | undefined;
/** Parsed cookies that have not been signed */
cookies: Record<string, any>;
/** Parsed cookies that have been signed */
signedCookies: Record<string, any>;
}
}
declare function cookieParser(
secret?: string | string[],
options?: cookieParser.CookieParseOptions,
): express.RequestHandler;
declare namespace cookieParser {
interface CookieParseOptions {
decode?(val: string): string;
}
function JSONCookie(jsonCookie: string): object | undefined;
function JSONCookies<T extends { [key: string]: string }>(jsonCookies: T): { [P in keyof T]: object | undefined };
function signedCookie(cookie: string, secret: string | string[]): string | false;
function signedCookies<T extends { [key: string]: string }>(
cookies: T,
secret: string | string[],
): { [P in keyof T]?: string | false };
}
export = cookieParser;
These definitions were written by Santi Albo, BendingBender, and Sebastian Beltran.
cookie-session is a middleware for Express that enables session support through cookies. Unlike @types/cookie-parser, which is focused on parsing cookies and populating req.cookies, cookie-session is used for managing session state in web applications, storing session data on the client-side within cookies. It provides a different layer of functionality compared to simply parsing cookies.
express-session is another session management middleware for Express, but unlike cookie-session, it supports storing session data on the server-side, with the session ID being stored in a cookie on the client-side. This approach offers more control and security over session data compared to storing all session data within cookies. While @types/cookie-parser is focused on parsing cookies, express-session deals with sessions more comprehensively.
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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.