-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes: #1679. Remove unsafe-eval directive from our CSP policy. #1682
Conversation
grunt-tasks/jst.js
Outdated
// strip the opening and closing <script> tags... | ||
// otherwise, the template functions will just inject script elements | ||
// that won't render. | ||
src = src.split(/\<script type=['"]text\/template['"]>/)[1]; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Better than expected!
|
Ah yeah, forgot about a tiny inline template in the labels code :))
|
Cool, that fixed it. |
<%= label.name %> | ||
</span> | ||
<% }); %> | ||
<script type="text/template"> |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
<header class="wc-Issue-labelEditor"> | ||
<div class="wc-Issue-labelEditor-title"> | ||
Labels | ||
</div> | ||
{% if session.user_id and session.avatar_url %} | ||
<% if ($("body").data("username")) { %> |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -1,3 +0,0 @@ | |||
{% macro dropdown(config) %} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@miketaylr that is really impressing. I went through the files and everything looks great on first glance including build & tests. But I'd like to take more time, to understand everything. Hope, this is ok. |
(oops, forgot to push docs commit) |
<% } %> | ||
</script> | ||
</div> | ||
{% include "web_modules/issue-list.jst" %} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Just so it's not lost, here's an explanation of what this PR is trying to achieve: |
webcompat/static/js/lib/labels.js
Outdated
].join("") | ||
), | ||
// relavant parts in issue/issue-labels.jst | ||
subTemplate: wcTmpl["issue/issue-lables-sub.jst"], |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@miketaylr The performance improvement is really impressive! :) I found a few small issues: CSP issue:
Labels:The placeholder for label is shown. When a label is added, it's not shown until a reload is fired manually. (See screenshots) Anchorhttp://localhost:5000/#contribute anchor directs not to the correct place as the issues are loaded later (from the all issues list on the index). |
@zoepage thanks for digging around and finding those issues! That |
OK, fixed the label editor issue (which also uncovered another small bug) and filed a follow up for the #contribute link (because that also exists in production): #1688 Just need to fix this package.json conflict. |
…hem accordingly.
…ndant files as a result. Unfortunately the pre-compiled template approach won't let us rely on the jinja2 parser to do interesting things with JS templates.
…tions of my issues should use the same issue template.
…ath for convenience.
…after modifying .jst templates.
Sweet! Thank you :) |
I just deployed this branch to staging if anyone wants to poke at it some more. Otherwise, will probably merge tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, after fixing the flash messaged things should be good. :)
Investigating... |
Yeah oops. Forgot about one last inline template. Fixed now! |
This is a pretty big change to how we do templates. But it's also 1000% safer than what we currently allow.
Please don't merge yet, but feel free to comment.ready for review/mergeIt also probably needs some docs updates to mention that if you ever change a template file, you'll need to re-run
grunt:jst
(orgrunt
). edit: done