News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DashExamples.com:
Capture Content Security Policy (CSP) Violations in PHP
August 22, 2011 @ 09:02:05

From DashExamples.com there's a quick post on how you can set up your application to notify you on content security policy violations and store them back on he server side for later review.

When somebody violates your CSP rules, there is a great feature that can setup for supporting browsers to send back the violations to your server to be saved, processed or whatever. This is a great feature because you can stop a possibly malicious piece of code from executing and learn which scripts may have vulnerabilities in your code.

The reports as delivered by the browser back to your server according to your site's policy setup. They're sent back as a JSON string that is easily parsed and stored. The post shows you a sample database table structure (storing things like request, headers, blocked location and IP address) and the PHP to handle the incoming post. For more about the CSP reports, see Mozilla's example on their Developer section.

0 comments voice your opinion now!
content security violation csp json tutorial mozilla


blog comments powered by Disqus

Similar Posts

BarelyFitz.com: CSS Colors - Take Control Using PHP

DevShed: Factoring Content Boxes with the Factory Pattern in PHP 5

PHP-Security.net: New PHP-CGI Exploit (CVE-2012-1823)

IBM developerWorks: Developing PHP the Ajax way, Part 2 - Back, Forward, Reload

Hasin Hayder's Blog: expanding short url to original url using PHP and CURL


Community Events

Don't see your event here?
Let us know!


introduction interview framework version php7 library list api laravel laravel5 voicesoftheelephpant release language example podcast community extension security opinion series

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework