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

Add goal parameter checks to JavaScript #3205

Closed
wants to merge 1 commit into from

Conversation

bmeck
Copy link

@bmeck bmeck commented Nov 6, 2017

See bmeck/I-D#17


💥 Error: Wattsi server error 💥

PR Preview failed to build. (Last tried on Jan 15, 2021, 7:58 AM UTC).

More

PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

🚨 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.

🔗 Related URL

Command failed: /home/noderunner/wattsi/bin/wattsi /tmp/upload_ef1eb03de057b43a01f709354ab5dca2 (sha not provided) i48z4dlmxgn default /tmp/upload_36644803e7b8233ff6ef70c2cdf70b7a

If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.

@domenic domenic added do not merge yet Pull request must not be merged per rationale in comment needs implementer interest Moving the issue forward requires implementers to express interest normative change labels Nov 6, 2017
@domenic
Copy link
Member

domenic commented Nov 6, 2017

I am -1 on this change. I think the current setup works well and I don't think this adds anything to the ecosystem. I know @annevk disagrees, but that's where we're at.

In short I don't think adding this server-side configuration knob adds anything. We already have good signals on the client side and this just adds potential confusion and opportunity for conflict.

Given the arguments presented so far, we are not interested in implementing this in Chrome.

@bmeck
Copy link
Author

bmeck commented Nov 6, 2017

@domenic can you clarify

this just adds potential confusion

Is there a way to remove this confusion by changing something?

@domenic
Copy link
Member

domenic commented Nov 6, 2017

No, I think the existence of the goal parameter causes confusion compared to the existing mechanisms of selecting classic vs. module script, and as such we should not introduce it into browsers in any way. (I.e. we should treat it like any other unknown parameter.)

@bmeck
Copy link
Author

bmeck commented Nov 6, 2017

@domenic

Then, do you feel it is not desirable for a server to be able to guard its content to be restricted to one goal of JS? Which seems to be part of @allenwb 's review in bmeck/I-D#1

@domenic
Copy link
Member

domenic commented Nov 6, 2017

Right, I don't think that's necessary, or at least we haven't seen any developer demand for it yet.

@annevk
Copy link
Member

annevk commented Nov 6, 2017

If we made this goal parameter authoritative (and reject when it's wrong) browsers could more easily add optimizations throughout the loading pipeline as they no longer need out-of-band information as to what the type of the resource is.

@domenic
Copy link
Member

domenic commented Nov 6, 2017

That's reasonably compelling. Are there any implementers interested in using that signal?

@domenic
Copy link
Member

domenic commented Nov 6, 2017

Actually, it's not necessary to reject when it's wrong, since the browser can just de-opt if it turns out to be incorrect.

@annevk
Copy link
Member

annevk commented Nov 6, 2017

A hard fail seems like better developer ergonomics. And also better for users as the de-opt won't happen with deployed code and therefore user resources are not wasted.

@mathiasbynens
Copy link
Member

Allowing code to be executed with the wrong goal sounds like a potential security risk.

@annevk
Copy link
Member

annevk commented Nov 7, 2017

For tests, we'll need:

  • Goal parameter with empty value
  • Goal parameter with weird casing for parameter name
  • Goal parameter with weird casing for parameter value
  • Goal parameter with whitespace around parameter value (e.g., =" module")
  • Potentially also some MIME type tests, such as goal="\s\c\r\i\p\t", especially if we make these tests reusable in some way for Node.js

The language in the PR will also need to be cleaned up a bit, but would be good to hear from @whatwg/modules what they think about this first.

@annevk
Copy link
Member

annevk commented Nov 7, 2017

I tried to think through the security argument. It seems that if you only have text/javascript;goal=module scripts and you enforce that through a MIME type you can be positive they can only be executed on the same origin (or origins you opted into with CORS) the moment all clients relevant to you have implemented this change.

Another thing to test:

  • Goal parameter specified on a non-JavaScript MIME type.

bmeck pushed a commit to bmeck/web-platform-tests that referenced this pull request Nov 7, 2017
This adds tests regarding scripts with a speified goal parameter
whatwg/html#3205

TEST=wpt/html/semantics/scripting-1/the-script-element/goal.htm
@bmeck
Copy link
Author

bmeck commented Nov 8, 2017

@annevk Put up a PR for tests. Is there anything else to do for now?

@annevk
Copy link
Member

annevk commented Nov 9, 2017

@bmeck great, thanks. At this point we need to wait for implementers and the folks from @whatwg/modules to weigh in.

@annevk
Copy link
Member

annevk commented Dec 17, 2017

Firefox supports making this change.

@travisleithead @Constellation?

@bmeck
Copy link
Author

bmeck commented Jan 29, 2018

@annevk to unblock this should I do anything? It has been over 1 month since I saw the comment that Firefox supports this, do I need to PR an implementation to them before this can be merged?

@annevk
Copy link
Member

annevk commented Jan 30, 2018

@bmeck per https://whatwg.org/working-mode we need two interested implementers. There's also a bunch of other changes that need to be made, but I was waiting for more folks to reply before doing a more thorough review.

Maybe @whatwg/security is more interested in this than @whatwg/modules?

To be clear the proposal here is to add a goal parameter to JavaScript MIME types so you can state your script is a classic or module script. If the parameter is present, the browser would enforce its value and refuse to interpret a module script loaded from <script src=modulescript> for instance.

@demurgos demurgos mentioned this pull request Jul 9, 2018
gsnedders pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 3, 2018
This adds tests regarding scripts with a specified goal parameter
whatwg/html#3205
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Sep 10, 2018
…al parameter, a=testonly

Automatic update from web-platform-testsImplement script MIME restrictions for goal parameter (#8094)

This adds tests regarding scripts with a specified goal parameter
whatwg/html#3205
--

wpt-commits: 395d96467d0fa57b3006b13ce1855e86e2b42907
wpt-pr: 8094
jankeromnes pushed a commit to jankeromnes/gecko that referenced this pull request Sep 10, 2018
…al parameter, a=testonly

Automatic update from web-platform-testsImplement script MIME restrictions for goal parameter (#8094)

This adds tests regarding scripts with a specified goal parameter
whatwg/html#3205
--

wpt-commits: 395d96467d0fa57b3006b13ce1855e86e2b42907
wpt-pr: 8094
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 17, 2018
This test was committed without the corresponding standard change at whatwg/html#3205 having landed.

Reverts #8094.
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Sep 20, 2018
Automatic update from web-platform-testsDelete goal-parameter.htm

This test was committed without the corresponding standard change at whatwg/html#3205 having landed.

Reverts #8094.
--

wpt-commits: fb745708cbe264d7477b846cb87d67dcce310e27
wpt-pr: 13034
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this pull request Sep 20, 2018
Automatic update from web-platform-testsDelete goal-parameter.htm

This test was committed without the corresponding standard change at whatwg/html#3205 having landed.

Reverts #8094.
--

wpt-commits: fb745708cbe264d7477b846cb87d67dcce310e27
wpt-pr: 13034
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
…al parameter, a=testonly

Automatic update from web-platform-testsImplement script MIME restrictions for goal parameter (#8094)

This adds tests regarding scripts with a specified goal parameter
whatwg/html#3205
--

wpt-commits: 395d96467d0fa57b3006b13ce1855e86e2b42907
wpt-pr: 8094

UltraBlame original commit: f0211683bbeb7893daaa440a15aec604f7eacf3e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
Automatic update from web-platform-testsDelete goal-parameter.htm

This test was committed without the corresponding standard change at whatwg/html#3205 having landed.

Reverts #8094.
--

wpt-commits: fb745708cbe264d7477b846cb87d67dcce310e27
wpt-pr: 13034

UltraBlame original commit: 17bfa2cc509890b4fe9b6294a4600d207c10f921
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
…al parameter, a=testonly

Automatic update from web-platform-testsImplement script MIME restrictions for goal parameter (#8094)

This adds tests regarding scripts with a specified goal parameter
whatwg/html#3205
--

wpt-commits: 395d96467d0fa57b3006b13ce1855e86e2b42907
wpt-pr: 8094

UltraBlame original commit: f0211683bbeb7893daaa440a15aec604f7eacf3e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
Automatic update from web-platform-testsDelete goal-parameter.htm

This test was committed without the corresponding standard change at whatwg/html#3205 having landed.

Reverts #8094.
--

wpt-commits: fb745708cbe264d7477b846cb87d67dcce310e27
wpt-pr: 13034

UltraBlame original commit: 17bfa2cc509890b4fe9b6294a4600d207c10f921
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
…al parameter, a=testonly

Automatic update from web-platform-testsImplement script MIME restrictions for goal parameter (#8094)

This adds tests regarding scripts with a specified goal parameter
whatwg/html#3205
--

wpt-commits: 395d96467d0fa57b3006b13ce1855e86e2b42907
wpt-pr: 8094

UltraBlame original commit: f0211683bbeb7893daaa440a15aec604f7eacf3e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
Automatic update from web-platform-testsDelete goal-parameter.htm

This test was committed without the corresponding standard change at whatwg/html#3205 having landed.

Reverts #8094.
--

wpt-commits: fb745708cbe264d7477b846cb87d67dcce310e27
wpt-pr: 13034

UltraBlame original commit: 17bfa2cc509890b4fe9b6294a4600d207c10f921
Base automatically changed from master to main January 15, 2021 07:57
@annevk
Copy link
Member

annevk commented Apr 28, 2021

Unfortunately this didn't go anywhere and it would be too late to add restrictions retroactively. And https://tools.ietf.org/html/draft-ietf-dispatch-javascript-mjs#section-6.1.1 doesn't seem to pursue this parameter anymore, so closing.

@annevk annevk closed this Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge yet Pull request must not be merged per rationale in comment needs implementer interest Moving the issue forward requires implementers to express interest normative change topic: script
Development

Successfully merging this pull request may close these issues.

4 participants