Skip to content

Set CSP header for index.html#44

Merged
pifantastic merged 1 commit intomasterfrom
csp
Jun 7, 2013
Merged

Set CSP header for index.html#44
pifantastic merged 1 commit intomasterfrom
csp

Conversation

@pifantastic
Copy link
Copy Markdown
Member

Fixes #43

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh bummer, yeah we need to yank the handlebars templates out before we can remove the unsafe-eval bit. Should aim to do that for sure.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah :/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can do this:

<script type="text/x-handlebars" data-template-name="application" src="/path/to/.hbs>

With unsafe-eval switched on, a lot of the benefits of CSP are lost.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that work? Won't Handlebars still eval the response?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to precompile them? Will that work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that's possible if we were using requirejs, and if we ran the require optimizer. However, that's only practical in a "production" scenario, don't want that in dev. We could also do some sort of fancy precompilation on the server, but that means porting the Handlebars parser to go :P

@marktheunissen
Copy link
Copy Markdown
Member

Merge this if you like, but then we should open a follow-up issue to remove unsafe-eval.

pifantastic added a commit that referenced this pull request Jun 7, 2013
Set CSP header for index.html
@pifantastic pifantastic merged commit 55a9f45 into master Jun 7, 2013
@marktheunissen
Copy link
Copy Markdown
Member

nice one 🍰

@marktheunissen marktheunissen deleted the csp branch June 7, 2013 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement content security policy headers.

2 participants