-
Notifications
You must be signed in to change notification settings - Fork 12
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
Do we want to enforce HTTPS request? #27
Comments
Hi there! Chrome web platform security reviewer here, we believe that it would be best not to build new APIs that allow HTTP communications. HTTPS is well established and its deployment has never been easier. |
@letitz We could update the API to only accept HTTPS endpoints, i.e. However the API itself can still be run on a page with HTTP orign. In such case, the API cannot enforce HTTPS for relative URLs: // In http://not-safe.com
let p = PendingGetBeacon('/target');
// p is expected to sent to http://not-safe.com/target I am not familar with other APIs yet. Are there any examples about how to deal with this kind of issues? |
I imagine the constructor could construct the full URL of the target and check that the scheme is In JS (though this would likely be handled by the browser itself): function checkUrl(url) {
const absoluteUrl = new URL(url, window.location);
if (absoluteUrl.protocol !== "https:") {
throw new TypeError("scheme is not https");
}
}
class PendingGetBeacon {
constructor(url, ...) {
checkUrl(url);
...
}
setUrl(url) {
checkUrl(url);
...
}
} This behavior would have to be specified as well. |
If you try to call |
There are a large number of APIs that are only available on https pages -- we usually do this with a |
That's true, and we could consider restricting this API to secure contexts. However, the point of this issue is slightly different: whether requests to |
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845
Thanks for all your help. I am going to also update the explainer to only support this API in secure contexts. |
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3955986 Reviewed-by: Rakina Zata Amni <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Commit-Queue: Ming-Ying Chung <[email protected]> Cr-Commit-Position: refs/heads/main@{#1063911}
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3955986 Reviewed-by: Rakina Zata Amni <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Commit-Queue: Ming-Ying Chung <[email protected]> Cr-Commit-Position: refs/heads/main@{#1063911}
According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3955986 Reviewed-by: Rakina Zata Amni <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Commit-Queue: Ming-Ying Chung <[email protected]> Cr-Commit-Position: refs/heads/main@{#1063911}
…d make API secure-context only, a=testonly Automatic update from web-platform-tests [beacon-api] Allow only HTTPS targets and make API secure-context only According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3955986 Reviewed-by: Rakina Zata Amni <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Commit-Queue: Ming-Ying Chung <[email protected]> Cr-Commit-Position: refs/heads/main@{#1063911} -- wpt-commits: 97cd7633f583bff5b856f816eba1de189c7c3903 wpt-pr: 36491
…d make API secure-context only, a=testonly Automatic update from web-platform-tests [beacon-api] Allow only HTTPS targets and make API secure-context only According to the [discussion][1], this CL makes the API only available in [secure context][2], and blocks all non-HTTPS request URLs in the PendingBeacon API: 1. The API throws `TypeError` when url provided to the following APIs are not HTTPs. Note that relative URLs or URLs without schema still work: A. ctor: `PendingGetBeacon(url)` & `PendingPostBeacon(url)` B. `PendingGetBeacon.setURL(url)` 2. The entire `PendingBeacon` API becomes only available in SecureContext, i.e. on an HTTPS page. [1]: WICG/pending-beacon#27 [2]: https://w3c.github.io/webappsec-secure-contexts/ Bug: 1293679 Change-Id: I20b2ece0fe490decea80ead6f4740b65c9a36845 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3955986 Reviewed-by: Rakina Zata Amni <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Commit-Queue: Ming-Ying Chung <[email protected]> Cr-Commit-Position: refs/heads/main@{#1063911} -- wpt-commits: 97cd7633f583bff5b856f816eba1de189c7c3903 wpt-pr: 36491
One of the requirement listed in the "Privacy" section is "Beacons must be sent over HTTPS."
But would it conflict with the goal to make it easy for developers to migrate to use this API? (this wasn't a requirement for
navigator.sendBeacon()
).The text was updated successfully, but these errors were encountered: