Urgent.News

What's breaking now, across hundreds of outlets.

Tech

How to Configure CSP Headers: The Web Security Header That Actually Catches Things

$32 $33 Why Developers Care Three reasons to actually deploy CSP: It catches real bugs. I've had CSP reports reveal XSS vulnerabilities that I'd missed - places where user input was being rendered without escaping in a forgotten corner of the app. The browser literally told me "I blocked this script execution, here's why." It's a compliance requirement. PCI DSS, HIPAA, NIST 800-53, and most…

Why Developers Deploy Content Security Policy (CSP) Three reasons to actually implement CSP: it catches genuine bugs, it meets compliance requirements, and it makes attackers' jobs harder. Developers have discovered CSP revealing XSS vulnerabilities they'd missed, and the browser alerts when it blocks script execution. PCI DSS, HIPAA, NIST 800-53, and most security audits now mandate CSP for internet-facing applications.

A strict CSP also makes a buggy site with it more difficult to exploit than a buggy site without it. Deploying CSP correctly is time-consuming, typically taking a few days for moderately complex apps, plus ongoing maintenance for new third-party scripts. The cost of not deploying it is a larger attack surface and a worse incident postmortem.

Prerequisites for CSP deployment include a web application under your control, where you can modify HTTP response headers, a way to serve a "report only" version alongside the enforcing version, a modern browser for testing (Chrome, Firefox, Safari, Edge all support CSP), and a basic understanding of how your app loads resources.

The CSP Evaluator browser extension from Google helps flag weaknesses in your policy during iteration.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

How floating-point numbers are stored (and why 0.1 isn't exact)

Disclosure: this post was written with AI assistance and checked by the FlashKit team. Open any console and type 0.1 + 0.2 . You get 0.30000000000000004 .

  • Floating-point numbers consist of sign bit, exponent, and mantissa
  • 0.1 cannot be stored exactly due to binary representation limitations
  • 0.1 + 0.2 ≠ 0.3 due to rounding errors in floating-point arithmetic

More from Friday 27 November →