Bug 1515298 [wpt PR 14599] - SignedExchange: Reject SXG if fallback URL has invalid UTF-8 sequence, a=testonly
authorKunihiko Sakamoto <ksakamoto@chromium.org>
Thu, 31 Jan 2019 12:12:59 +0000
changeset 457755 c680ff16a9c7a3ff68ac3372ddf0c50263e55a24
parent 457754 fb60acc92b129683cc32b7d4496ff90d100fc9d3
child 457756 e1200509b61a8e96e0c4a4d0d0555c8aa37eca03
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1515298, 14599, 916390, 1382724, 617772
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 1515298 [wpt PR 14599] - SignedExchange: Reject SXG if fallback URL has invalid UTF-8 sequence, a=testonly Automatic update from web-platform-tests SignedExchange: Reject SXG if fallback URL has invalid UTF-8 sequence GURL parser happily accepts invalid UTF-8 path, so we need to validate the fallback URL string before parsing. Spec: https://github.com/WICG/webpackage/pull/346 Bug: 916390 Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222 Reviewed-on: https://chromium-review.googlesource.com/c/1382724 Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Cr-Commit-Position: refs/heads/master@{#617772} -- wpt-commits: e663fa084dcdac43fea5cdd6c69b059b5ad0743f wpt-pr: 14599
testing/web-platform/tests/signed-exchange/resources/generate-test-sxgs.sh
testing/web-platform/tests/signed-exchange/resources/sxg-invalid-utf8-inner-url.sxg
testing/web-platform/tests/signed-exchange/resources/sxg-invalid-utf8-inner-url.sxg.headers
testing/web-platform/tests/signed-exchange/sxg-invalid-utf8-inner-url.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
@@ -111,16 +111,32 @@ gen-signedexchange \
   -certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
   -validityUrl $inner_url_origin/signed-exchange/resources/resource.validity.msg \
   -privateKey $keyfile \
   -date 2018-04-01T00:00:00Z \
   -expire 168h \
   -o sxg-utf8-inner-url.sxg \
   -miRecordSize 100
 
+# Fallback URL has invalid UTF-8 sequence.
+gen-signedexchange \
+  -version 1b2 \
+  -ignoreErrors \
+  -uri "$inner_url_origin/signed-exchange/resources/$(echo -e '\xce\xce\xa9').html" \
+  -status 200 \
+  -content sxg-location.html \
+  -certificate $certfile \
+  -certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
+  -validityUrl $inner_url_origin/signed-exchange/resources/resource.validity.msg \
+  -privateKey $keyfile \
+  -date 2018-04-01T00:00:00Z \
+  -expire 168h \
+  -o sxg-invalid-utf8-inner-url.sxg \
+  -miRecordSize 100
+
 # Fallback URL has UTF-8 BOM.
 gen-signedexchange \
   -version 1b2 \
   -ignoreErrors \
   -uri "$(echo -e '\xef\xbb\xbf')$inner_url_origin/signed-exchange/resources/inner-url.html" \
   -status 200 \
   -content sxg-location.html \
   -certificate $certfile \
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1f697b74b0d787d7cc30420c2cb68d0388d10b20
GIT binary patch
literal 951
zc$}3|yKWOf6g5y`et?2vag&GR-L>Ply_VwjW1ZNE?KrWMf@pSkygT;ngPn2KPLw7E
z4P_b{kP;A5M2BdQpr*5g5ET4C3d$%FCF>ZYP$6cd(Y;sa+;i{Ikf9b1$q}C~rBiB?
zG{=P_36}S6IGv0}qZ~n+3DpoBDmpMV$T^T$14n^`8;{Rfof_D8>&)jn!$5{O!+3CE
zu~ys?D~&>);;`No-JZe4i?%rG%haq@ZPx(JR(-c8<|W;UlsO*v8WpYVN-M4;NqRM}
z<E_}^lGqsRHb#6(ZbsJBs99*m3+}F7DLbA(hS>)gsfdn30|yI%|DJsov9ms`L9{@I
zK_-Qo<K;p?MH(cOGf;@=AQFp*_+<~EK!^UV=|VYVV?eu>W3bet{7d`KkSrN$tPKrT
zku7J|dnzU@+M8RcL8q(6aJz~7yGHN;>YzI8blZAfuE5oDy|l7l3#RlEnfRds3Wabi
z5{X6mB+q9UIJA+cIjJp&qp>*8AD@=f2Bf;BisfSKRcX3lCv|f}p|7Ff_Ks+@!#%Ci
zS=D-0qL?_S1&ax5d)-`H2Q}2HY;pi8eW9Et6wm<?BRpSKEYCWVhUmzKo%<9HDL45X
z-c~wr2&BS*c0<Yf3<gcbQjw`uZ>syIN6kJgY>2I$dXbs5$oaDrQ4Dk9l*?FMX7k!z
zsnx0%e;b_TrXYWoC=Rk|&hH{qwOkgcYH{DART1&n(3zhzAR*v&<8t|HQ~L2iN}W7m
zKc|n!r*|H`JQ%+_zxV#~0>0JY+!8YnC(H##$T5e0hPlpI&uYNhmP5UV(AuP#2Imj4
zr2vX7GtH=$GB75{S&7vh*j-`}+3Ny~WuWxaj298|>3MQb{C@J_O<UT&y1?Jki`mBA
dkI!CQ1-{(gc={6_EoA&hOV?QFg;{R4+b^TlN`3$U
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/signed-exchange/resources/sxg-invalid-utf8-inner-url.sxg.headers
@@ -0,0 +1,2 @@
+Content-Type: application/signed-exchange;v=b2
+X-Content-Type-Options: nosniff
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/signed-exchange/sxg-invalid-utf8-inner-url.tentative.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>SignedHTTPExchange's fallback url must not have invalid UTF-8 sequence</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-invalid-utf8-inner-url.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's fallback url must not have invalid UTF-8 sequence");
+
+</script>
+</body>