Skip to content

Commit

Permalink
examples: Update strict-csp example with better nonce (#55131)
Browse files Browse the repository at this point in the history
Follow up to #55039.
  • Loading branch information
leerob authored Sep 8, 2023
1 parent f47c409 commit 12252c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/with-strict-csp/middleware.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextResponse } from 'next/server'

export function middleware(request) {
const nonce = crypto.randomUUID()
const nonce = Buffer.from(crypto.randomUUID()).toString('base64')
const cspHeader = `
default-src 'self';
script-src 'self' 'nonce-${nonce}' 'strict-dynamic';
Expand Down

0 comments on commit 12252c2

Please sign in to comment.