edge-csrf icon indicating copy to clipboard operation
edge-csrf copied to clipboard

Add support for partitioned cookies

Open bookernath opened this issue 7 months ago • 2 comments

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;

bookernath avatar Jul 21 '24 13:07 bookernath