edge-csrf
edge-csrf copied to clipboard
Add support for partitioned cookies
For cookies set within iframes it's helpful to set the Partitioned
flag to have compatibility with Chrome's CHIPS update.
Example usage might be:
// middleware.ts
import { createCsrfMiddleware } from '@edge-csrf/nextjs';
// initalize csrf protection middleware
const csrfMiddleware = createCsrfMiddleware({
cookie: {
secure: process.env.NODE_ENV === 'production',
partitioned: true, // add this new arg
},
});
export const middleware = csrfMiddleware;