-
Notifications
You must be signed in to change notification settings - Fork 72
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
Description vs URL parsing #71
Comments
Certainly we'll want to spell this out in more detail in the proper spec. For now I'll note that the first paragraph of https://github.com/domenic/import-maps#import-urls says
I guess that's inaccurate (or, only accurate for "conforming" So this somewhat reduces to whatwg/url#385, which has unfortunately seen little movement. |
URL protocols like For example, according to Std 66 and RFC 8089, new URL('../bar', 'file:foo/').href === 'file:///bar' IMO, it's reasonable to assume that resolving two relative paths gives you a relative path, but this is not the case. This can only lead to subtle bugs and probably enables bypassing of mitigations for path traversal attacks. If I'm happy to provide spec language to identify corner cases like this if needed. |
@annevk There is no ambiguity in the meaning of path-absolute = "/" [ segment-nz *( "/" segment ) ] so an absolute path cannot start with a slash, an empty path component, and another slash. |
@mikesamuel browsers use https://url.spec.whatwg.org/ not STD 66. |
I don't think we will need anything like relative path support for built-in module specifiers. Any of the options in whatwg/url#385 would avoid this complexity (and any of them seem like they would work decently for this application; we just need a choice documented). |
@annevk, Fair enough. I believe https://url.spec.whatwg.org/#path-or-authority-state is the equivalent.
|
@littledan, Why the "for built-in module specifiers" qualification? Apologies if I'm operating from the wrong premises, but f an With |
Right, I was just being confused above; path-like import: URLs might make sense to process with some intelligence. |
I misstated something in OP. The potential problem is not with parsing, the potential problem is with processing the resulting the URL record. |
@annevk I think inheriting |
The |
@annevk, maybe I don't understand what you mean by "parser problem." I realize, belatedly, that the code sample above is parser related, but the equivalent problem in STD 66 isn't. Perhaps my confusion comes from whatwg/url's differences that follow from for-scheme-state:
If import-maps specs path resolution-like operations on |
Okay, as far as I can tell those corner cases are basically OP and whatwg/url#385. |
I haven't looked at the standard, but you might want to clarify how
import:
URLs areparsed[processed]. E.g.,import://test.com/../y
shouldn't result in being treated identically toimport:/y
probably.The text was updated successfully, but these errors were encountered: