Archive for the ‘javascript’ Category

Mozilla’s Content Security Policy (CSP)

Tuesday, June 30th, 2009

I saw this post via SlashDot and can’t help but think it’s a little overkill?

Content Security Policy is intended to mitigate a large class of Web Application Vulnerabilities: Cross Site Scripting. Cross Site Request Forgery has also become a large scale problem in Web Application Security, though it is not a primary focus of Content Security Policy.

In an ideal world, this would be great, but getting all the browsers on board and implemented may take a while. I was thinking about this the other day and I don’t see why the browsers/w3c can’t standardise on some sort of tag or conditional comments that says don’t execute any script in here. This would be simple to use and surely simple to implement. Browsers already know what to do with <noscript>

For Example:

<dontexecutescript>
    <?php echo $this->escape($userProvidedContent);?>
</dontexecutescript>

Or:

<!--[dontexecutescript] -->
    <?php echo $this->escape($userProvidedContent);?>
<!--[dontexecutescript]-->

I’m no expert on XSS, but I’m pretty sure this would solve most of the issues encountered.

Update:

Okay, so one obvious problem might be that the $userProvidedContent contains a closing </dontexecutescript> tag, but that’s just semantics. Unique identifiers for each block, ignoring tags that don’t match up, these browser developers are clever, they could come up with something.

Meeting Cost Clock

Wednesday, December 24th, 2008

Meeting Clock

I wrote a simple Meeting Cost Clock after having a little search on google for a simple one (I actually found this one after writing mine). It’s easy to use, you enter the number of participants, the average salary for those participants, then click start. It’s a little rudimentary, the JavaScript is probably a little rough, but it’ll serve me right.

I’ve styled it using iPhone universal, a CSS framework for making iPhone stylee pages, so one of my colleagues can open it up on his iPhone in our next meeting.