NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #2047 most downloaded on Packagist
Easily add and update Content-Security-Policy headers for your project
Latest stable
v3.1.0
Last release 3 months ago
18 Aug 2026
Ships fairly regularly
a new release about every 8 months
Nearly every release is documented
notes for 26 of 28 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
28 releases · first in 2015
Drag across the ruler to compare, or tap a release to open it.
Add getPolicies method to CSPBuilder class by @jahidulpabelislam in https://github.com/paragonie/csp-builder/pull/80
Full Changelog: https://github.com/paragonie/csp-builder/compare/v3.0.2...v3.1.0
Full Changelog: v3.0.2...v3.1.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
add updates for PHP 8.4 by @cliffordvickrey in https://github.com/paragonie/csp-builder/pull/78
Full Changelog: https://github.com/paragonie/csp-builder/compare/v3.0.1...v3.0.2
Full Changelog: v3.0.1...v3.0.2
* #77 - prevent duplicate policies * Updated dependencies
un-deprecate frame-src by @fritzmg in https://github.com/paragonie/csp-builder/pull/76
CSPBuilder::fromHeader) by @fritzmg in https://github.com/paragonie/csp-builder/pull/74frame-src by @fritzmg in https://github.com/paragonie/csp-builder/pull/76default-src policy is applied by @fritzmg in https://github.com/paragonie/csp-builder/pull/65Full Changelog: https://github.com/paragonie/csp-builder/compare/v2.9.0...v3.0.0
CSPBuilder::fromHeader) by @fritzmg in #74frame-src by @fritzmg in #76default-src policy is applied by @fritzmg in #65Full Changelog: v2.9.0...v3.0.0
Add support for psr/http-message v2 by @internalsystemerror in https://github.com/paragonie/csp-builder/pull/73
psr/http-message v2 by @internalsystemerror in https://github.com/paragonie/csp-builder/pull/73Full Changelog: https://github.com/paragonie/csp-builder/compare/v2.8.1...v2.9.0
psr/http-message v2 by @internalsystemerror in #73Full Changelog: v2.8.1...v2.9.0
Add 'url' type value for report-uri by @danieltott in https://github.com/paragonie/csp-builder/pull/61
plugin-types generation by @fritzmg in https://github.com/paragonie/csp-builder/pull/69Full Changelog: https://github.com/paragonie/csp-builder/compare/v2.8.0...v2.8.1
plugin-types generation by @fritzmg in #69Full Changelog: v2.8.0...v2.8.1
Prevent semicolon or CLRF injection. See https://github.com/paragonie/csp-builder/commit/1a1a85fcf115400d7753af842403ec6e846319de for details.
Prevent semicolon or CLRF injection. See https://github.com/paragonie/csp-builder/commit/1a1a85fcf115400d7753af842403ec6e846319de for details.
CSP-Builder is a developer tool. It is not meant to be used with user input.
However, the ability to inject CSP directives or additional headers violates the principle of least astonishment.
This was reported via user demonia on HackerOne.
Add support for "unsafe-hashes" directive
Fixed #23 -- duplicate directives are now prevented
Consistently invalidate the compiled CSP cache.
* #42 - In Chrome 76, this library's behavior with report-to does not work. Specifically, you cannot pass a URL as a report-to directive or Chrome wil
report-to does not work. Specifically, you cannot pass a URL as a report-to directive or Chrome will never send CSP reports, even if there is also a report-uri fallback. @iangcarroll provided a pull request that fixes this behavior.Nothing published for this version
Added CSPBuilder::fromArray() because its absence seemed confusing if you're not familiar with the constructor.
always clause to nginx header. Thanks @alainwolfblob:, filesystem:, and data: URIs.CSPBuilder::fromArray() because its absence seemed confusing if you're not familiar with the constructor.Add dedicated API method for setting report-to/report-uri directives.
report-to/report-uri directives.'strict-dynamic' and 'unsafe-hashed-attributes'Added several helper methods, e.g. setDataAllowed() and setSelfAllowed(), for programatically allowing self and data: URIs for a specific directive.
setDataAllowed() and setSelfAllowed(), for programatically allowing self and data: URIs for a specific directive.Allow CSPBuilder instances to be instantiated from a JSON string. Thanks @renanmpimentel
Allow CSPBuilder instances to be instantiated from a JSON string. Thanks @renanmpimentel
This allows us to use strict typing and drop random_compat as a dependency.
Version 2.0.0 requires PHP 7.
This allows us to use strict typing and drop random_compat as a dependency.
Contains a year of bugfixes and tweaks from the v2 branch, backported for PHP 5 support.
Contains a year of bugfixes and tweaks from the v2 branch, backported for PHP 5 support.
Version 1.3.2 broke somewhere in the git chain, so v1.3.3 it is.
Version 1.3.2 broke somewhere in the git chain, so v1.3.3 it is.
Minor (some annoying) bug fixes
unsafe-eval directivesFull list here: https://github.com/paragonie/csp-builder/compare/v1.3.0...v1.3.1
BC break: Changed our erroneous connect-uri and font-uri directives to connect-src and font-src respectively.
A lot of bugfixes since 1.2.0.
BC break: Changed our erroneous connect-uri and font-uri directives to connect-src and font-src respectively.
Before version 1.4, I'd like to improve the documentation and unit test coverage. Feel free to open any issues for bugs you encounter or feature requests you might have.
Use normal Base64 encoding for CSP hashes.
Use normal Base64 encoding for CSP hashes.
It turns out that the hash directive just needs to be sha256-blah not hash-sha256-blah.
It turns out that the hash directive just needs to be sha256-blah not hash-sha256-blah.
Add preHash(), which allows users to precalculate a hash of a resource and store it directly in the CSP. (Mostly useful for locally caching the hashes
Add preHash(), which allows users to precalculate a hash of a resource and store it directly in the CSP. (Mostly useful for locally caching the hashes of remote resources.)
Confirmed that CSP headers work as expected with report-uri.io
hash()report-uri.ioThanks @Ocramius and @Lewiscowles1986 for their feedback and assistance. (If it weren't for the possibly BC-breaking changes, this would have simply b…
random_compat instead of openssl for generating a nonceplugin-types directive (see #4)Thanks @Ocramius and @Lewiscowles1986 for their feedback and assistance. (If it weren't for the possibly BC-breaking changes, this would have simply been 1.1.1.)
General improvements, especially with older Webkit browsers.
General improvements, especially with older Webkit browsers.
Thanks to @timoh6 and @ScottHelme for their feedback.
Nothing published for this version
One column per quarter.