VOOZH about

URL: https://codereview.chromium.org/596043003/

⇱ Issue 596043003: Basic console error messages for subresource integrity. - Code Review


Keyboard Shortcuts

File
u :up to issue
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
Issue
u :up to list of issues
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
👁 Image
Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Issues Search
    My Issues | Starred     Open | Closed | All

👁 Image
Issue 596043003: Basic console error messages for subresource integrity. (Closed)

Created:
6 years, 3 months ago by jww
Modified:
6 years, 2 months ago
Reviewers:
Mike West
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Basic console error messages for subresource integrity. Subresource integrity is behind an experimental flag in blink (see https://codereview.chromium.org/566083003). This CL adds in some useful console error messages when things go wrong, such as non-matching integrity values or an unparsable integrity attribute. R=mkwst@chromium.org BUG=355467 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183000

Patch Set 1 #

Patch Set 2 : Updated some of the FIXME comments #

Total comments: 8

Patch Set 3 : Rebase on ToT #

Patch Set 4 : Addressed comments from mkwst #

Total comments: 4

Patch Set 5 : Typos #

Patch Set 6 : Fixed broken test expected values #

Created: 6 years, 2 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
👁 Image
M LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-blocked-expected.txt View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
👁 Image
M LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-invalid-integrity-expected.txt View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
👁 Image
M Source/core/dom/ScriptLoader.cpp View 1 1 chunk +0 lines, -1 line 0 comments Download
👁 Image
M Source/core/frame/SubresourceIntegrity.cpp View 1 2 3 4 7 chunks +62 lines, -13 lines 0 comments Download

Messages

Total messages: 13 (3 generated)
jww 6 years, 3 months ago (2014-09-23 23:36:37 UTC) #1

 
Mike West
Thanks! A few comments inline. https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/SubresourceIntegrity.cpp File Source/core/frame/SubresourceIntegrity.cpp (right): https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/SubresourceIntegrity.cpp#newcode117 Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The 'integrity' attribute '" ...
6 years, 3 months ago (2014-09-24 08:40:28 UTC) #2
Thanks! A few comments inline.

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
File Source/core/frame/SubresourceIntegrity.cpp (right):

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The
'integrity' attribute '" + attribute + "' does not parse as a valid integrity.",
document);
How about "The 'integrity' attribute's value '" + attribute + "' is not valid
integrity metadata."?

It would be nice to get a little more detail by hooking into the parser, as we
do in CSP, but this is a perfectly reasonable start.

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:136: logErrorToConsole("The computed
" + algorithmToString(algorithm) + " integrity '" + digestToString(digest) + "'
does not match the 'integrity' attribute '" + integrity + "'.", document);
This message exposes the digest of the resource. As long as the message _only_
goes to the console, this is fine. If we start throwing exceptions, or reporting
this as a violation event or something in the future, we'll need to be careful
to avoid exposing that information to JavaScript.

Would you mind adding a comment to that effect?

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:139: logErrorToConsole("There was an
error computing an 'integrity' value for a resource.", document);
Perhaps you could pass a KURL into this method to improve messages like this
one. (e.g. url.elidedString() instead of "a resource"). This is especially
important for the previous error; if there are three integrity'd resources on a
page, there's no easy way for the developer to figure out which one failed.

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:150: // respective entries in the
kAlgorithmMap array in checkDigest().
// as well as the array in algorithmToString().
jww
Hey Mike. Sorry it took so long, but I think I addressed your comments. https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/SubresourceIntegrity.cpp ...
6 years, 2 months ago (2014-09-30 01:38:50 UTC) #3
Hey Mike. Sorry it took so long, but I think I addressed your comments.

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
File Source/core/frame/SubresourceIntegrity.cpp (right):

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The
'integrity' attribute '" + attribute + "' does not parse as a valid integrity.",
document);
On 2014/09/24 08:40:27, Mike West wrote:
> How about "The 'integrity' attribute's value '" + attribute + "' is not valid
> integrity metadata."?
> 
> It would be nice to get a little more detail by hooking into the parser, as we
> do in CSP, but this is a perfectly reasonable start.
Yeah, first part done, and I figure we can do more detailed later.

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:136: logErrorToConsole("The computed
" + algorithmToString(algorithm) + " integrity '" + digestToString(digest) + "'
does not match the 'integrity' attribute '" + integrity + "'.", document);
On 2014/09/24 08:40:28, Mike West wrote:
> This message exposes the digest of the resource. As long as the message _only_
> goes to the console, this is fine. If we start throwing exceptions, or
reporting
> this as a violation event or something in the future, we'll need to be careful
> to avoid exposing that information to JavaScript.
> 
> Would you mind adding a comment to that effect?

Done.

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:139: logErrorToConsole("There was an
error computing an 'integrity' value for a resource.", document);
On 2014/09/24 08:40:27, Mike West wrote:
> Perhaps you could pass a KURL into this method to improve messages like this
> one. (e.g. url.elidedString() instead of "a resource"). This is especially
> important for the previous error; if there are three integrity'd resources on
a
> page, there's no easy way for the developer to figure out which one failed.

Done.

https://codereview.chromium.org/596043003/diff/20001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:150: // respective entries in the
kAlgorithmMap array in checkDigest().
On 2014/09/24 08:40:28, Mike West wrote:
> // as well as the array in algorithmToString().

Done.
Mike West
LGTM % typos. Thanks! https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/SubresourceIntegrity.cpp File Source/core/frame/SubresourceIntegrity.cpp (right): https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/SubresourceIntegrity.cpp#newcode117 Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The 'integrity' attribute's value '" ...
6 years, 2 months ago (2014-09-30 09:13:28 UTC) #4
LGTM % typos. Thanks!

https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
File Source/core/frame/SubresourceIntegrity.cpp (right):

https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The
'integrity' attribute's value '" + attribute + "' is not valid integrity
metadat.", document);
s/metadat/metadata/.

https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:138: // need to be very carefully not
to expose this in exceptions or
s/carefully/careful/
jww
https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/SubresourceIntegrity.cpp File Source/core/frame/SubresourceIntegrity.cpp (right): https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/SubresourceIntegrity.cpp#newcode117 Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The 'integrity' attribute's value '" + attribute + "' ...
6 years, 2 months ago (2014-09-30 17:59:33 UTC) #5
https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
File Source/core/frame/SubresourceIntegrity.cpp (right):

https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The
'integrity' attribute's value '" + attribute + "' is not valid integrity
metadat.", document);
On 2014/09/30 09:13:28, Mike West wrote:
> s/metadat/metadata/.

Done.

https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:138: // need to be very carefully not
to expose this in exceptions or
On 2014/09/30 09:13:28, Mike West wrote:
> s/carefully/careful/

Done.
jww
https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/SubresourceIntegrity.cpp File Source/core/frame/SubresourceIntegrity.cpp (right): https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/SubresourceIntegrity.cpp#newcode117 Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The 'integrity' attribute's value '" + attribute + "' ...
6 years, 2 months ago (2014-09-30 17:59:33 UTC) #6
https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
File Source/core/frame/SubresourceIntegrity.cpp (right):

https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:117: logErrorToConsole("The
'integrity' attribute's value '" + attribute + "' is not valid integrity
metadat.", document);
On 2014/09/30 09:13:28, Mike West wrote:
> s/metadat/metadata/.

Done.

https://codereview.chromium.org/596043003/diff/60001/Source/core/frame/Subres...
Source/core/frame/SubresourceIntegrity.cpp:138: // need to be very carefully not
to expose this in exceptions or
On 2014/09/30 09:13:28, Mike West wrote:
> s/carefully/careful/

Done.
jww
The CQ bit was checked by jww@chromium.org
6 years, 2 months ago (2014-09-30 17:59:38 UTC) #7
The CQ bit was checked by jww@chromium.org
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/596043003/80001
6 years, 2 months ago (2014-09-30 18:00:11 UTC) #8
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 2 months ago (2014-09-30 19:02:06 UTC) #9
The CQ bit was unchecked by commit-bot@chromium.org
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/27138)
6 years, 2 months ago (2014-09-30 19:02:07 UTC) #10
Try jobs failed on following builders:
 linux_blink_rel on tryserver.blink
(http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/2...)
jww
The CQ bit was checked by jww@chromium.org
6 years, 2 months ago (2014-09-30 19:16:04 UTC) #11
The CQ bit was checked by jww@chromium.org
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/596043003/100001
6 years, 2 months ago (2014-09-30 19:16:38 UTC) #12
commit-bot: I haz the power
Committed patchset #6 (id:100001) as 183000
6 years, 2 months ago (2014-09-30 23:05:55 UTC) #13
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as 183000
👁 Powered by Google App Engine
This is Rietveld 408576698