I've been reviewing CSRF and CSP and noticed that many web security protections are still opt-in. They often exist to patch weaknesses or unsafe assumptions built into older standards. That made sense when the web evolved slowly, since changing a standard could break countless existing sites and servers.
But with AI making software development much faster—and cybersecurity risks potentially growing—why don't browsers introduce stricter secure-by-default behavior through a gradual, multi-year rollout? For example, could browsers eventually apply something like `Content-Security-Policy: default-src 'none'` unless a site explicitly opts into the resources it needs?
It would certainly create migration work, but browsers have pushed major changes before, such as encouraging HTTPS. Why not take a similar approach for other security standards?
4 Answers
AI-generated code doesn’t solve the hardest part of this problem. It can help rewrite an application, but it cannot guarantee that a new policy preserves all of the site’s behavior, understands undocumented dependencies, or avoids introducing new vulnerabilities. Plenty of websites also run on old software that nobody actively maintains.
The safer direction is usually incremental: browsers can deprecate dangerous features, restrict them in secure contexts, provide reporting and diagnostics, and make secure configurations easier. Developers still need to explicitly configure policies such as CSP because only they know which resources their application is supposed to trust.
The main issue is backward compatibility. A restrictive CSP applied automatically would immediately break a huge number of existing sites, including old systems that people still rely on. AI might reduce the effort needed to update code, but it doesn’t remove the need to understand each application’s behavior, dependencies, and deployment setup.
There’s also a coordination problem: if one browser blocks sites while its competitors still allow them, users will probably switch browsers instead of waiting for every site to be fixed. That makes it difficult for any single vendor to lead a change that breaks compatibility.
Some secure behavior is already enforced by default. The same-origin policy is built into browsers, and mechanisms such as CORS exist to allow carefully controlled exceptions. Browsers also increasingly require secure contexts for sensitive APIs and warn about insecure connections.
HTTPS is a slightly different example from automatically imposing CSP. Browsers didn’t simply make every HTTP site stop working; certificates became easier to obtain, hosting platforms added support, and browsers progressively warned users or restricted particular features. The site owner still had to configure HTTPS.
Browsers generally avoid breaking existing websites because users experience the failure as a browser problem, not as the developer’s mistake. If a site someone needs for work, banking, government services, or an old internal system stops loading, they’ll likely blame the browser and move to one that still works.
That creates a strong incentive for browsers to preserve compatibility, even when the old behavior is less secure. A strict default such as blocking every script, image, or connection would be far more disruptive than simply warning users.

A gradual rollout could help, but it would still require browsers, hosting providers, developers, and businesses to agree on timelines. The technical migration may be manageable; getting everyone aligned is usually harder.