
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
next-universal-cookie
Advanced tools
Provides way to read, set and delete a cookie for Next.js similar to
expresssuch as req.cookies, res.cookie and res.clearCookie
npm install next-universal-cookie
import {GetServerSideProps, NextPageContext} from 'next';
import {applyServerSideCookie} from 'next-universal-cookie';
export const getServerSideProps: GetServerSideProps = async ({req, res}) => {
applyServerSideCookie(req, res);
// Typescript-ready
// Parse all cookies
const allCookies = req.cookies;
// Set
res.cookie();
// Delete
res.clearCookie();
return {
props: {},
};
};
// pages/api/index.ts
import {NextApiRequest, NextApiResponse} from 'next';
import {applyApiCookie} from 'next-universal-cookie';
export default function handler(
req: NextApiRequest,
res: NextApiResponse<{ok: boolean}>
) {
applyApiCookie(req, res);
// Typescript-ready
const allCookies = req.cookies;
res.cookie();
res.clearCookie();
// Response
res.json({
ok: true,
});
}
import {applyServerSideCookie, applyApiCookie} from 'next-universal-cookie';
MIT
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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.