Repository navigation
[wptserve] Add on-demand file hash computation - #8735
Conversation
Build PASSEDStarted: 2017-12-23 01:38:56 View more information about this build on: |
|
Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. tools/wptserve/wptserve/pipes.py, line 376 at r1 (raw file):
I really think this should look more like a function call. I know that will make the patch bigger and mean a change to the tokenizer and the uuid function, but the current setup looks pretty odd. Comments from Reviewable |
|
@jgraham That sounds good to me. Do you think we could do that in a follow-up patch, or do you consider it a prerequisite for this fix? |
|
(I'm asking because I'd like to limit the prerequisites to introducing the new |
|
|
||
| <script src="/resources/testharness.js" integrity="sha384-4Nybydhnr3tOpv1yrTkDxu3RFpnxWAxlU5kGn7c8ebKvh1iUdfVMjqP6jf0dacrV"></script> | ||
| <script src="/resources/testharnessreport.js" integrity="sha384-GOnHxuyo+nnsFAe4enY+RAl4/+w5NPMJPCQiDroTjxtR7ndRz7Uan8vNbM2qWKmU"></script> | ||
| <script src="/resources/testharness.js" integrity="sha384-{{sha384[resources/testharness.js]}}"></script> |
There was a problem hiding this comment.
Rather than using testharness.js, could we not add another file that doesn't ever change?
There was a problem hiding this comment.
I think you misunderstand the test. If you have a CSP stating require-sri-for script all scripts in the document need to have integrity defined. That includes the harness scripts.
There was a problem hiding this comment.
Ah, didn't even know that was a thing or read very closely. Makes a lot more sense now.
|
I'm not too keen on introducing one syntax and then changing it immediately. And I'm even less keen on introducing one syntax and then changing it, but not immediately. So I would prefer to fix the syntax right from the start unless it's really too time consuming. |
426c172 to
97b3626
Compare
|
I've re-implemented the functionality on top of a slightly modified template parsing engine. I've also expanded the feature to support all the hashing algorithms that Python provides. The surrounding code was missing some test coverage, so I added tests for that to help give us confidence that there are no regressions here. For the sake of clarity, I'd prefer it if we could merge this work using distinct commits like the ones submitted here. @jgraham Does this look better to you? |
|
Review status: 0 of 10 files reviewed at latest revision, 3 unresolved discussions, all commit checks successful. tools/wptserve/wptserve/pipes.py, line 306 at r3 (raw file):
This is a greedy regex I think, so it's going to break for cases like tools/wptserve/wptserve/pipes.py, line 393 at r3 (raw file):
A better error message here would be nice. Comments from Reviewable |
|
This looks very good, just a couple of minor things to fix before merge. |
Sounds good. I've made the change, but I can't think of a way to test that, though. Any ideas?
You got it. |
Build PASSEDStarted: 2018-02-05 16:46:19 View more information about this build on: |
6e0e6ed to
e5d062b
Compare
|
Reviewed 2 of 5 files at r1, 4 of 10 files at r2, 6 of 8 files at r3, 1 of 2 files at r4, 1 of 1 files at r5. tools/wptserve/wptserve/pipes.py, line 394 at r5 (raw file):
Not a blocker, but in general using Comments from Reviewable |
|
@jugglinmike Want to rebase this to reorganise the commits and then land it? |
e5d062b to
ac362a3
Compare
|
Sure thing, James. While implementing your last bit of feedback about assertions, I realized that that functionality wasn't tested. So in addition to explicitly raising a The prior version of this change set is available on the following branch: |
Additionally, update the two Web Platform Tests which previously specified static values for the expected hash of shared resource files.
ac362a3 to
0c73688
Compare
|
I also had the pleasant surprise of failing a new test that didn't exist when I wrote this patch. Thanks, @gsnedders :) Updated that test accordingly. |
|
Reviewed 4 of 4 files at r6. Comments from Reviewable |
|
Thanks! |
Certain tests require that all HTML
<script>tags be declared with anintegrityattribute which specifies the cryptographic hash of the fileto be loaded. These tests were initially implemented with a static value
for the hash of the test harness files located in the shared "resources"
directory.
In order to support continued development of those shared files, the
tests should be authored in a way that is tolerant of such
modifications.
Introduce a new templating capability to the
wptserveutility whichallows markup to be rendered with dynamically-computed hash values.
Allowing the shared resources to change independently of the tests that
rely on them.
Hi @gsnedders,
I'm working on an enhancement to
testharness.js(see gh-6075), and I foundthat my latest patch broke a few tests (specifically, those introduced via
gh-7684). I was surprised to find that the error had nothing to do with the
semantics of my change--just the fact that I had made any change at all.
This is an initial attempt to facilitate continued development of
testharness.js. It's pretty rough because it's based on an afternoon's reviewof the
wptserveinternals. I'm requesting your review because I believe youmay have some vision for the overall direction of WPT's server. If you think
there is someone better to give direction, then I'm all ears!
(@annevk and @domenic: my hope is that if this lands, future tests that require
strict file integrity checking can be a little more resilient to change.)
This change is