Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strictly UTF-8 decode the fallback URL #346

Merged
merged 1 commit into from
Dec 5, 2018

Conversation

jyasskin
Copy link
Member

@jyasskin jyasskin commented Nov 30, 2018

Bikeshed warned that I'd never defined |fallbackUrl|, but I missed it
before going on parental leave. Do y'all see any problems with picking this conversion from bytes to a string?

@irori, we ought to test this with a couple bad fallback URLs, say one starting with a BOM, and one with an invalid sequence that the UTF-8 decoder might convert to U+FFFD. Would you be willing to add those tests?


Preview | Diff

@jyasskin jyasskin requested review from nyaxt and irori November 30, 2018 23:19
Bikeshed warned that I'd never defined |fallbackUrl|, but I missed it
before going on parental leave.
@jyasskin jyasskin force-pushed the utf-8-decode-fallback-url branch from 876b3c9 to 121ecb1 Compare December 1, 2018 00:31
Copy link
Collaborator

@irori irori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will add the tests.

@jyasskin
Copy link
Member Author

jyasskin commented Dec 4, 2018

I should add that I found https://cs.chromium.org/chromium/src/net/http/http_response_headers.cc?l=920&rcl=6aa20f013414d789e8d72752a6885ef3d990d274 after I wrote this change, indicating that maybe we'd rather Location headers be all-ASCII. We can enforce that for SXG URLs if y'all think it's a good idea.

This is also related to whatwg/fetch#843.

@annevk
Copy link

annevk commented Dec 4, 2018

UTF-8 is generally preferable I think, but it depends a bit on what kind of field this is. Happy to help if you could give some context.

@jyasskin
Copy link
Member Author

jyasskin commented Dec 4, 2018

@annevk This is the field at the beginning of the Signed Exchange format that gives both the URL of the inner resource and a target to redirect to if the Signed Exchange is broken (doesn't parse, the signature doesn't validate, maybe other things).

@annevk
Copy link

annevk commented Dec 5, 2018

I'd make those UTF-8. The URL parser will turn it all into ASCII, but it seems preferable to be able to serialize in more ways.

@jyasskin jyasskin merged commit f603e91 into WICG:master Dec 5, 2018
@jyasskin jyasskin deleted the utf-8-decode-fallback-url branch December 5, 2018 15:38
@jyasskin
Copy link
Member Author

jyasskin commented Dec 5, 2018

Thanks, @annevk!

@nyaxt nyaxt mentioned this pull request Dec 13, 2018
10 tasks
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 19, 2018
GURL parser happily accepts invalid UTF-8 path, so we need to validate
the fallback URL string before parsing.

Spec: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 19, 2018
GURL parser happily accepts invalid UTF-8 path, so we need to validate
the fallback URL string before parsing.

Spec: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 19, 2018
GURL parser happily accepts invalid UTF-8 path, so we need to validate
the fallback URL string before parsing.

Spec: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
aarongable pushed a commit to chromium/chromium that referenced this pull request Dec 19, 2018
GURL parser happily accepts invalid UTF-8 path, so we need to validate
the fallback URL string before parsing.

Spec: WICG/webpackage#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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 19, 2018
GURL parser happily accepts invalid UTF-8 path, so we need to validate
the fallback URL string before parsing.

Spec: WICG/webpackage#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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 19, 2018
GURL parser happily accepts invalid UTF-8 path, so we need to validate
the fallback URL string before parsing.

Spec: WICG/webpackage#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}
@irori
Copy link
Collaborator

irori commented Dec 20, 2018

For the record, tests for this are web-platform-tests/wpt@2e19cbe and web-platform-tests/wpt@e663fa0.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Feb 5, 2019
…RL 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: WICG/webpackage#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
mykmelez pushed a commit to mykmelez/gecko that referenced this pull request Feb 6, 2019
…RL 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: WICG/webpackage#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
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Feb 7, 2019
…RL 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: WICG/webpackage#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
mykmelez pushed a commit to mykmelez/gecko that referenced this pull request Feb 8, 2019
…RL 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: WICG/webpackage#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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
…RL 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: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
Reviewed-on: https://chromium-review.googlesource.com/c/1382724
Commit-Queue: Kunihiko Sakamoto <ksakamotochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Reviewed-by: Kouhei Ueno <kouheichromium.org>
Cr-Commit-Position: refs/heads/master{#617772}

--

wpt-commits: e663fa084dcdac43fea5cdd6c69b059b5ad0743f
wpt-pr: 14599

UltraBlame original commit: 812e25f081670195d2e97402e27d1fa54a8860e7
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
…RL 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: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
Reviewed-on: https://chromium-review.googlesource.com/c/1382724
Commit-Queue: Kunihiko Sakamoto <ksakamotochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Reviewed-by: Kouhei Ueno <kouheichromium.org>
Cr-Commit-Position: refs/heads/master{#617772}

--

wpt-commits: e663fa084dcdac43fea5cdd6c69b059b5ad0743f
wpt-pr: 14599

UltraBlame original commit: c680ff16a9c7a3ff68ac3372ddf0c50263e55a24
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
…RL 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: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
Reviewed-on: https://chromium-review.googlesource.com/c/1382724
Commit-Queue: Kunihiko Sakamoto <ksakamotochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Reviewed-by: Kouhei Ueno <kouheichromium.org>
Cr-Commit-Position: refs/heads/master{#617772}

--

wpt-commits: e663fa084dcdac43fea5cdd6c69b059b5ad0743f
wpt-pr: 14599

UltraBlame original commit: 812e25f081670195d2e97402e27d1fa54a8860e7
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
…RL 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: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
Reviewed-on: https://chromium-review.googlesource.com/c/1382724
Commit-Queue: Kunihiko Sakamoto <ksakamotochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Reviewed-by: Kouhei Ueno <kouheichromium.org>
Cr-Commit-Position: refs/heads/master{#617772}

--

wpt-commits: e663fa084dcdac43fea5cdd6c69b059b5ad0743f
wpt-pr: 14599

UltraBlame original commit: c680ff16a9c7a3ff68ac3372ddf0c50263e55a24
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 4, 2019
…RL 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: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
Reviewed-on: https://chromium-review.googlesource.com/c/1382724
Commit-Queue: Kunihiko Sakamoto <ksakamotochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Reviewed-by: Kouhei Ueno <kouheichromium.org>
Cr-Commit-Position: refs/heads/master{#617772}

--

wpt-commits: e663fa084dcdac43fea5cdd6c69b059b5ad0743f
wpt-pr: 14599

UltraBlame original commit: 812e25f081670195d2e97402e27d1fa54a8860e7
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 4, 2019
…RL 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: WICG/webpackage#346

Bug: 916390
Change-Id: Ife25621e2a41beef01cbf36a5ab523eaee1ea222
Reviewed-on: https://chromium-review.googlesource.com/c/1382724
Commit-Queue: Kunihiko Sakamoto <ksakamotochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Reviewed-by: Kouhei Ueno <kouheichromium.org>
Cr-Commit-Position: refs/heads/master{#617772}

--

wpt-commits: e663fa084dcdac43fea5cdd6c69b059b5ad0743f
wpt-pr: 14599

UltraBlame original commit: c680ff16a9c7a3ff68ac3372ddf0c50263e55a24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants