Content Security Policy (CSP) - security

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
Posts
Registered User
Posts: 6
Joined: Thu Feb 05, 2009 6:16 pm

Content Security Policy (CSP) - security

Post by Posts »

Firefox 4
Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks.
Enabling CSP is as easy as configuring your web server to return the X-Content-Security-Policy HTTP header.
Example of change required:
* User Agents MUST block:
o The contents of internal <script> nodes
o javascript: URIs, e.g. <a href="javascript:bad_stuff()"> (unless enabled by policy)
o Event-handling attributes, e.g. <a onclick="bad_stuff()">

* User Agents MUST NOT block:
o Scripts imported from external files whose sources are allowed by the protected document's policy AND are served with a Content-Type of application/javascript or application/json.
https://developer.mozilla.org/en/Introd ... ity_Policy
https://wiki.mozilla.org/Security/CSP/Specification
https://wiki.mozilla.org/Security/CSP/S ... strictions

phpMyAdmin
http://www.phpmyadmin.net/documentation/changelog.php
"+ [core] Include Content Security Policy HTTP headers."

MantisBT bugtracking
http://www.mantisbt.org/blog/?p=119
"As Firefox 4 has been pushed back to early 2011 we have more time to finish off the implementation of X-Content-Security-Policy within MantisBT."
Last edited by Posts on Tue Jan 11, 2011 10:49 pm, edited 1 time in total.

/a3
Registered User
Posts: 97
Joined: Mon Sep 20, 2010 6:44 am

Re: Content Security Policy (CSP)

Post by /a3 »

Wow, that's cool...
/me adds headers to my own website straight away. 8-)

Hopefully other browsers might implement this as well.
$ git commit -m "YOLO"

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: Content Security Policy (CSP)

Post by naderman »

Sounds like a good idea.

Peppy
Registered User
Posts: 5
Joined: Sat May 07, 2011 11:39 pm

Re: Content Security Policy (CSP) - security

Post by Peppy »

But it's only available in Firefox? And what about other browsers? But it's seems to be good to implement at pages which has forms...

/a3
Registered User
Posts: 97
Joined: Mon Sep 20, 2010 6:44 am

Re: Content Security Policy (CSP) - security

Post by /a3 »

Yes, but phpBB also uses browser-specific code in the case of Internet Explorer (for attachments and avatars regarding IE's MIME sniffing, I believe).

Obviously this header would only be protecting against potential attacks, not attacks that are known at this time. However, quite a large number of people use Gecko-based browsers, and I think it would be worth it.
$ git commit -m "YOLO"

Post Reply