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

Restrict setting protocol to "file" #269

Merged
merged 2 commits into from
Mar 15, 2017
Merged

Restrict setting protocol to "file" #269

merged 2 commits into from
Mar 15, 2017

Conversation

annevk
Copy link
Member

@annevk annevk commented Mar 10, 2017

As file URLs cannot have username/password/port we don’t want to allow
changing the scheme of a URL that contains one or more of those
components.

Fixes #259.


Preview | Diff

As file URLs cannot have username/password/port we don’t want to allow
changing the scheme of a URL that contains one or more of those
components.

Fixes #259.
@watilde
Copy link

watilde commented Mar 10, 2017

This looks good to me to fix the issue, but I'm worried about the change seems a new behaviour that browsers don't have yet.

@annevk
Copy link
Member Author

annevk commented Mar 10, 2017

Tests at web-platform-tests/wpt#5112.

Yeah, we'll need to file browser bugs. What browsers currently do doesn't make any sense, so hopefully this can still change.

and <var>buffer</var> is "<code>file</code>", then return.

<li><p>If <var>url</var>'s <a for=url>scheme</a> is "<code>file</code>" and its
<a for=url>host</a> is an <a>empty host</a> or null, then return.
Copy link
Member

@rmisev rmisev Mar 10, 2017

Choose a reason for hiding this comment

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

I think the last item must be:

4. If url's host is an empty host or null, and buffer is a non-"file" special scheme, then return.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's only "file" that can come here and hit this. Other non-special schemes cannot be set to special schemes due to the earlier steps.

Copy link
Member

Choose a reason for hiding this comment

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

Yes you are right.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I could remove the check for scheme being "file" though, since only file can have an empty/null host.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that would be bad, since that would also block non-special URLs without host from changing schemes. Oops.

@annevk annevk merged commit 462fdc1 into master Mar 15, 2017
@annevk annevk deleted the annevk/protocol-setter branch March 15, 2017 08:37
domenic added a commit to jsdom/whatwg-url that referenced this pull request Mar 15, 2017
domenic added a commit to jsdom/whatwg-url that referenced this pull request Mar 15, 2017
watilde added a commit to watilde/node that referenced this pull request Mar 18, 2017
Since file URLs can not have `username/password/port`,
the specification was updated to restrict setting protocol to "file".

Refs: whatwg/url#269
Fixes: nodejs#11785
watilde added a commit to nodejs/node that referenced this pull request Mar 20, 2017
Since file URLs can not have `username/password/port`,
the specification was updated to restrict setting protocol to "file".

Refs: whatwg/url#269
Fixes: #11785
PR-URL: #11887
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
jungx098 pushed a commit to jungx098/node that referenced this pull request Mar 21, 2017
Since file URLs can not have `username/password/port`,
the specification was updated to restrict setting protocol to "file".

Refs: whatwg/url#269
Fixes: nodejs#11785
PR-URL: nodejs#11887
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
MylesBorins pushed a commit to nodejs/node that referenced this pull request Mar 28, 2017
Since file URLs can not have `username/password/port`,
the specification was updated to restrict setting protocol to "file".

Refs: whatwg/url#269
Fixes: #11785
PR-URL: #11887
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
rmisev added a commit to upa-url/upa that referenced this pull request May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants