-
Notifications
You must be signed in to change notification settings - Fork 118
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
Conversation
Bikeshed warned that I'd never defined |fallbackUrl|, but I missed it before going on parental leave.
876b3c9
to
121ecb1
Compare
There was a problem hiding this 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.
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 This is also related to whatwg/fetch#843. |
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. |
@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). |
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. |
Thanks, @annevk! |
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
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
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
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}
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}
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}
For the record, tests for this are web-platform-tests/wpt@2e19cbe and web-platform-tests/wpt@e663fa0. |
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
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