Bug 1528702 [wpt PR 15388] - SignedExchange: Close response body data pipe on integrity error, a=testonly
authorKunihiko Sakamoto <ksakamoto@chromium.org>
Tue, 05 Mar 2019 12:13:47 +0000
changeset 464539 1c69ba77f5c990db4c5e9f3f75665f38285a830c
parent 464538 e62189593f435ecfc20424de84d5b98a1284a75d
child 464540 c8eeaabc6e7804b4c59ccd205131a6556caf3db4
push id35717
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:45:26 +0000
treeherdermozilla-central@e0861be8d6c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1528702, 15388, 931955, 1470355, 632118
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528702 [wpt PR 15388] - SignedExchange: Close response body data pipe on integrity error, a=testonly Automatic update from web-platform-tests SignedExchange: Close response body data pipe on integrity error This fixes a bug where data pipe for response body was not closed when Signed Exchange has payload integrity error. SourceStreamToDataPipe::OnComplete() attempts to close the pipe by resetting |pending_write_|. But if |source_| is a FilterSourceStream, it still retains a reference to |pending_write_|. We should explicitly call |pending_write_->Complete(0)| to free the pipe on error cases too. Bug: 931955 Change-Id: I63b2470dbb92aa57016c5c71222bcdabe889fd34 Reviewed-on: https://chromium-review.googlesource.com/c/1470355 Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#632118} -- wpt-commits: 2867bad83ba14201d96f1eaf54027164251fe541 wpt-pr: 15388
testing/web-platform/tests/signed-exchange/resources/generate-test-sxgs.sh
testing/web-platform/tests/signed-exchange/resources/sxg/sxg-merkle-integrity-error.sxg
testing/web-platform/tests/signed-exchange/sxg-merkle-integrity-error.tentative.html
testing/web-platform/tests/signed-exchange/sxg-prefetch-merkle-integrity-error.tentative.html
--- a/testing/web-platform/tests/signed-exchange/resources/generate-test-sxgs.sh
+++ b/testing/web-platform/tests/signed-exchange/resources/generate-test-sxgs.sh
@@ -267,9 +267,12 @@ gen-signedexchange \
   -validityUrl $inner_url_origin/signed-exchange/resources/resource.validity.msg \
   -privateKey $keyfile \
   -date 2018-04-01T00:00:00Z \
   -expire 168h \
   -o sxg/sxg-hsts.sxg \
   -miRecordSize 100 \
   -ignoreErrors true
 
+# Signed Exchange with payload integrity error.
+echo 'garbage' | cat sxg/sxg-location.sxg - >sxg/sxg-merkle-integrity-error.sxg
+
 rm -fr $tmpdir
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0c6dce01da270bdacf5d280551d56d1519aff3a3
GIT binary patch
literal 999
zc$}3|OKTHR7)=orvJ?>)F2*YKIgd;-Hm^xZ<D^NNq-m41X<f+8%+1U+^Xk1f&BW4$
zAQVA#;~%gHx_040a3lBws%sHJS1yVRMcn9}rjfc5@4#^GH{Utu`woMBJ;Ju5q0qcR
zh=-Fr9}(v`fj*IBJQj=b*wh`UvCvly;OLM?5W793Ld=_v0}<Op7H1IK3XL6vLXRxa
zhE|H9Bzd}`G;_t3+~$&2%;uCxBfeOu`t@dZAa+qqf?G?=*<Q62>CfT3-q^reHCxoP
z+gg6XF0W||gOU<;eJKjCCT%z4rNm5Wd(h;UD>bp~)@zb0Pp6n2V40dp2Ei2a_<wIO
zLflA)v#~y&VoZlX9nrfyu9-T-gttu=8$gt<vqF?Ms1T9AJ^QfDdKMrZ7ug)4lz(~u
z8Ir@k&Uw)0)V7O8+CwvW+N(Dcy;et)to2o^yJ^qdh6X76t<Ji!&@RH#VlAKDsmvsd
zJPz{E0D*Eu5=AK{#04S6K;JW|XHbhqV$yX%c#<Ek)JmM*Nfv<R%{fX@%{K>jKjByS
z+?w7m6t+mYX?2xi)n5Uz>Pl<1(3KaHm;lnlIZ+VGs!PLi2ulVYY+WMICw%Zb&^-)*
zFeGx1bl7-p)CL{Z)l5e(pLP!okCwi2V>#E@s3}Y!kqM`XNi3Mj4Y`clVd}?u78;G3
zauR8pA2x;4SVg8sGU2}IXl|banx^bfTG_;u4bkL;4KW7SUOYcKJm((1*^NBBaCz+e
zhx?zOo%i#v=clf|eEc9|=x}0|nS=pzijgzSZkS<?ZyXI5aGr|@ePL1w#B?|rd=HN0
zs(_fTlVmhk?b!igRN@Q-JF_Q!6vB^hr^U0sn4j;C?j`PAJb3y|%)Z~hd-Kcwt4~qo
w>zN-2L3Bzdpai9ngo$r;fMvCT+D$SPVYoMy3h&JhF@<S<l!XpZn@$=24N>J)eE<Le
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/signed-exchange/sxg-merkle-integrity-error.tentative.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>SignedHTTPExchange with payload integrity error</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="./resources/sxg-util.js"></script>
+<body>
+<script>
+promise_test(async (t) => {
+  try {
+    const sxgUrl = get_host_info().HTTPS_ORIGIN + '/signed-exchange/resources/sxg/sxg-merkle-integrity-error.sxg';
+    const message = await openSXGInIframeAndWaitForMessage(t, sxgUrl);
+    if (message.is_fallback) {
+        assert_unreached('Fallback redirect should not have happened');
+    } else {
+        assert_unreached('SXG should not have loaded');
+    }
+  } catch (e) {
+    assert_equals(e, 'timeout');
+  }
+}, "SignedHTTPExchange with payload integrity error");
+
+</script>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/signed-exchange/sxg-prefetch-merkle-integrity-error.tentative.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>Prefetching SignedHTTPExchange with payload integrity error should fail</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="./resources/sxg-util.js"></script>
+<body>
+<script>
+promise_test(async (t) => {
+  const sxgUrl = get_host_info().HTTPS_ORIGIN + '/signed-exchange/resources/sxg/sxg-merkle-integrity-error.sxg';
+  await new Promise(resolve => {
+    const link = document.createElement('link');
+    link.rel = 'prefetch';
+    link.href = sxgUrl;
+    link.addEventListener('error', t.step_func(() => {
+        resolve();
+    }));
+    link.addEventListener('load', t.step_func(() => {
+        assert_unreached('Prefetch should fail');
+    }));
+    document.body.appendChild(link);
+  });
+}, "Prefetching SignedHTTPExchange with payload integrity error should fail");
+
+</script>
+</body>