Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Issue 7003007: Apply content-security-policy to the HTML options page. This is a (Closed)

Created:
9 years, 7 months ago by Tom Sepez
Modified:
9 years, 7 months ago
CC:
chromium-reviews, GeorgeY, Ilya Sherman, dhollowa
Visibility:
Public.

Description

Pre-requisites needed before applying content-security-policy to the HTML options page. CSP is a second line of defense in case someone introduces an XSS in one of these pages. The changes to jstemplate_builder are to allow the template scripts to be served as resources where possible, and to return JS as well as HTML in the one case where the script is to be dynamically generated. The other changes are to combine the options javascript files into a single large file resource and to serve it from under chrome://settings. This satisfies the "no inline" rule and options.html can script src="" it. I did put one file into the /shared directory, since it is a companion to a piece of pre-existing template code alread in that directory. TEST=chrome://settings page loads properly. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=85322

Patch Set 1 #

Total comments: 6

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Total comments: 1

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Total comments: 5

Patch Set 9 : '' #

Patch Set 10 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+175 lines, -90 lines) Patch
M chrome/browser/browser_resources.grd View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/resources/options/options.html View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -70 lines 0 comments Download
A chrome/browser/resources/options/options_bundle.js View 1 2 3 4 5 6 7 8 1 chunk +72 lines, -0 lines 0 comments Download
A chrome/browser/resources/options_resources.grd View 1 2 3 4 5 6 7 1 chunk +15 lines, -0 lines 0 comments Download
A chrome/browser/resources/shared/js/i18n_process.js View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/resources/shared_resources.grd View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/options/options_ui.cc View 1 2 3 4 5 3 chunks +37 lines, -12 lines 0 comments Download
M chrome/chrome.gyp View 1 2 3 4 5 2 chunks +8 lines, -0 lines 0 comments Download
M chrome/common/common_resources.grd View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/jstemplate_builder.h View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/common/jstemplate_builder.cc View 1 2 3 4 5 2 chunks +23 lines, -7 lines 0 comments Download
M tools/grit/resource_ids View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 37 (0 generated)
Tom Sepez
Please review. Added Stuart and Evan as reviewers since they seem to have their fingers ...
9 years, 7 months ago (2011-05-10 21:01:53 UTC) #1
abarth-chromium
I wonder if this patch might be easier to review in smaller pieces, but I'll ...
9 years, 7 months ago (2011-05-10 21:11:45 UTC) #2
Tom Sepez
>ReplaceeSubstringsAfterOffset(&jstext, 0, "</", "<\\/"); > This escaping actually isn't allowed in JSON. This isn't really ...
9 years, 7 months ago (2011-05-10 21:35:39 UTC) #3
abarth-chromium
Using the \u syntax would work, I'm not sure it's that important for this to ...
9 years, 7 months ago (2011-05-10 21:39:17 UTC) #4
arv (Not doing code reviews)
Please do not put things in shared/ that is not supposed to be shared across ...
9 years, 7 months ago (2011-05-11 17:44:17 UTC) #5
arv (Not doing code reviews)
9 years, 7 months ago (2011-05-11 17:45:50 UTC) #6
Tom Sepez
On 2011/05/11 17:44:17, arv wrote: > Please do not put things in shared/ that is ...
9 years, 7 months ago (2011-05-11 17:52:31 UTC) #7
arv (Not doing code reviews)
Can we at least combine all these resources into a single resource so we don't ...
9 years, 7 months ago (2011-05-11 17:56:03 UTC) #8
Evan Stade
yea, please don't move the files or add them to shared_resources.grd. Instead you need to ...
9 years, 7 months ago (2011-05-11 18:01:39 UTC) #9
Evan Stade
On 2011/05/11 17:52:31, Tom Sepez wrote: > On 2011/05/11 17:44:17, arv wrote: > > Please ...
9 years, 7 months ago (2011-05-11 18:06:58 UTC) #10
Tom Sepez
Sure. Seems like there should be a new options_resources.grd file (which parallels what is going ...
9 years, 7 months ago (2011-05-11 18:09:12 UTC) #11
Evan Stade
On Wed, May 11, 2011 at 11:09 AM, <tsepez@chromium.org> wrote: > Sure. Seems like there ...
9 years, 7 months ago (2011-05-11 18:15:39 UTC) #12
Tom Sepez
Sure. But I'll try it first the other way to see if we notice a ...
9 years, 7 months ago (2011-05-11 18:18:20 UTC) #13
Evan Stade
On Wed, May 11, 2011 at 11:18 AM, <tsepez@chromium.org> wrote: > Sure. But I'll try ...
9 years, 7 months ago (2011-05-11 18:22:44 UTC) #14
abarth-chromium
On 2011/05/11 18:18:20, Tom Sepez wrote: > Sure. But I'll try it first the other ...
9 years, 7 months ago (2011-05-11 18:24:26 UTC) #15
Tom Sepez
Maybe we need a flattenjs option much like for flattenhtml? That way folks could work ...
9 years, 7 months ago (2011-05-11 18:30:53 UTC) #16
tony
On 2011/05/11 18:30:53, Tom Sepez wrote: > Maybe we need a flattenjs option much like ...
9 years, 7 months ago (2011-05-11 18:34:45 UTC) #17
Evan Stade
On Wed, May 11, 2011 at 11:30 AM, <tsepez@chromium.org> wrote: > Maybe we need a ...
9 years, 7 months ago (2011-05-11 18:45:38 UTC) #18
Tom Sepez
Heh. The flattenhtml preprocessor seems to do the right things wrt. <include> and <if> tags. ...
9 years, 7 months ago (2011-05-11 19:39:37 UTC) #19
Tom Sepez
Evan, arv, I think patch set 8 is ready for a review cycle. Thanks heaps.
9 years, 7 months ago (2011-05-11 23:20:31 UTC) #20
Evan Stade
http://codereview.chromium.org/7003007/diff/11004/chrome/browser/ui/webui/options/options_ui.cc File chrome/browser/ui/webui/options/options_ui.cc (right): http://codereview.chromium.org/7003007/diff/11004/chrome/browser/ui/webui/options/options_ui.cc#newcode130 chrome/browser/ui/webui/options/options_ui.cc:130: ResourceBundle::GetSharedInstance().GetRawDataResource( I'm surprised you have to make a copy. ...
9 years, 7 months ago (2011-05-12 01:12:00 UTC) #21
Tom Sepez
On 2011/05/12 01:12:00, Evan Stade wrote: > Doesn't resource bundle already cache, The pattern of ...
9 years, 7 months ago (2011-05-12 18:30:24 UTC) #22
Evan Stade
yea, ok. I think it's Tony who would be the best person to answer these ...
9 years, 7 months ago (2011-05-12 18:39:26 UTC) #23
tony
LGTM http://codereview.chromium.org/7003007/diff/11004/chrome/browser/resources/options/options_bundle.js File chrome/browser/resources/options/options_bundle.js (right): http://codereview.chromium.org/7003007/diff/11004/chrome/browser/resources/options/options_bundle.js#newcode1 chrome/browser/resources/options/options_bundle.js:1: <include src="preferences.js"></include> Nit: You might want to add ...
9 years, 7 months ago (2011-05-12 19:10:17 UTC) #24
Tom Sepez
Thanks, Tony. It appears to work when avoiding the copy from the string piece to ...
9 years, 7 months ago (2011-05-12 20:41:59 UTC) #25
tony
On 2011/05/12 20:41:59, Tom Sepez wrote: > If this is legit, then you can avoid ...
9 years, 7 months ago (2011-05-12 21:04:54 UTC) #26
Tom Sepez
Ran into issue with [27799:27799:0512/133747:5137520053:INFO:CONSOLE(143)] "Failed: undefined with exception: Code generation from strings disallowed for ...
9 years, 7 months ago (2011-05-12 21:25:19 UTC) #27
arv (Not doing code reviews)
LGTM
9 years, 7 months ago (2011-05-12 22:37:08 UTC) #28
Nikita (slow)
Seems that this CL broke settings on Chrome OS. In a result only "Basics" tab ...
9 years, 7 months ago (2011-05-16 12:18:48 UTC) #29
Tom Sepez
Looking at it now. Is there a bug number for this regression?
9 years, 7 months ago (2011-05-16 16:05:11 UTC) #30
Nikita (slow)
On Mon, May 16, 2011 at 8:05 PM, <tsepez@chromium.org> wrote: > Looking at it now. ...
9 years, 7 months ago (2011-05-16 16:34:11 UTC) #31
Tom Sepez
Just did a clean build of "chrome for chromeos" on linux (e.g. export GYP_DEFINES="chromeos=1") and ...
9 years, 7 months ago (2011-05-16 17:55:39 UTC) #32
Nikita (slow)
Yes, it might be the cause but I'll be able to verify only tomorrow. Hopefully ...
9 years, 7 months ago (2011-05-16 18:40:21 UTC) #33
Tom Sepez
Another data point might be to note whether versions prior to r85322 produced the same ...
9 years, 7 months ago (2011-05-16 19:40:16 UTC) #34
Tom Sepez
Previous comment is not likely. Deliberately breaking OptionsUI::RenderViewCreated() by commenting out the setting of: // ...
9 years, 7 months ago (2011-05-16 20:13:29 UTC) #35
Tom Sepez
s/85532/85322/. No matter, I verified files and code being executed in the "before" case.
9 years, 7 months ago (2011-05-16 20:35:44 UTC) #36
Tom Sepez
9 years, 7 months ago (2011-05-17 15:39:30 UTC) #37
See: http://code.google.com/p/chromium-os/issues/detail?id=15348

> Root cause is CommandLine refactoring and the way we reinitialize
> it in login_utils.cc

Ok. Glad you found it and that it is outside this CL

Powered by Google App Engine
This is Rietveld 408576698