Menu

Zero of our 79 pages send a Content-Security-Policy, and the strict version would need 892 hashes
📰

Zero of our 79 pages send a Content-Security-Policy, and the strict version would need 892 hashes

DEV Community: nextjs·Daniel Pertu·about 14 hours ago
#2lI49mRa
#devtonextjs#devto#dev#script#policy
Reading 0:00
15s threshold

Our site sends six security headers on every response. Count them yourself:

curl -sI https://pub-trivia.app/faq

Enter fullscreen mode

Exit fullscreen mode

You get strict-transport-security , x-content-type-options , x-frame-options , referrer-policy , permissions-policy and x-dns-prefetch-control . You do not get a content-security-policy , because there is no CSP anywhere in the 79 pages in our sitemap . I grepped the response headers of all 79: zero hits. I grepped the repository for the string: zero hits.

There is exactly one CSP on the whole origin, and we did not write it:

curl -sI 'https://pub-trivia.app/_next/image?url=%2Fdemo-1.webp&w=1200&q=75' | grep -i security

Enter fullscreen mode

Exit fullscreen mode

content - security - policy : script - src 'none' ; frame - src 'none' ; sandbox ;

Enter fullscreen mode

Exit fullscreen mode

That is Next.js hardcoding a policy on its own image optimiser, on the sensible theory that a route which echoes bytes back at you should not be a script host.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.