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 test for URL parsing of ICE servers in RTCConfiguration #47959

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dontcallmedom
Copy link
Contributor

see w3c/webrtc-pc#2853 and related discussions in w3c/webrtc-pc#2997 (comment)

Copy link
Contributor

@alvestrand alvestrand left a comment

Choose a reason for hiding this comment

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

Will be interesting to see the pass/fail on these.

I'm still hesitant about the idea of using the generic parser.
RFC 7065 (TURN URI) says that "developers MUST NOT use a generic hierarchical URI parser to parse a "turn" or "turns" URI".

@@ -301,4 +301,33 @@
}] }));
}, `with empty urls should throw SyntaxError`);

// Inspired from https://github.com/web-platform-tests/wpt/blob/master/url/resources/urltestdata.json
const validUrls = ['stun:example\t.\norg', 'stun:ex%61mple.net', 'stun:[2001::1]', 'stun:example(&!$)*+-.;_=~☺org', 'stun:example.net:', 'stun:example.net:0000000000000000', 'stun:example.net:65535', 'stun:example.net:\n', 'stun:GOO\u200b\u2060\ufeffgoo.com', '\u0000\u001b\u0004\u0012 stun:example.com\u001f \u000d ', 'stun:www.foo。bar.com', 'stun:Go.com', 'stun:你好你好', 'stun:faß.ExAmPlE', 'stun:%30%78%63%30%2e%30%32%35%30.01', 'stun:%30%78%63%30%2e%30%32%35%30.01%2e', 'stun:0Xc0.0250.01', 'stun:.', 'stun:ho\u0009st', "stun:!\"$&'()*+,-.;=_`{}~", "stun:\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u000B\u000C\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u007F!\"$%&'()*+,-.;=_`{}~", "stun:h\to\ns\rt:9\t0\n0\r0", 'stun:1.2.3.4.', 'stun:192.168.257', '192.168.257.com', 'stun:256', 'stun:256.com', 'stun:999999999', 'stun:0xffffffff',
Copy link
Contributor

Choose a reason for hiding this comment

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

can you format those blocks with one URL per line (s/,/,\n/) for easier reading and commenting?
Note that 192.168.257 is a perfectly valid IP address, but it means the same as 192.168.1.1 (I think).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reformatted (and indeed, it is in the list of valid addresses)

// Inspired from https://github.com/web-platform-tests/wpt/blob/master/url/resources/urltestdata.json
const validUrls = ['stun:example\t.\norg', 'stun:ex%61mple.net', 'stun:[2001::1]', 'stun:example(&!$)*+-.;_=~☺org', 'stun:example.net:', 'stun:example.net:0000000000000000', 'stun:example.net:65535', 'stun:example.net:\n', 'stun:GOO\u200b\u2060\ufeffgoo.com', '\u0000\u001b\u0004\u0012 stun:example.com\u001f \u000d ', 'stun:www.foo。bar.com', 'stun:Go.com', 'stun:你好你好', 'stun:faß.ExAmPlE', 'stun:%30%78%63%30%2e%30%32%35%30.01', 'stun:%30%78%63%30%2e%30%32%35%30.01%2e', 'stun:0Xc0.0250.01', 'stun:.', 'stun:ho\u0009st', "stun:!\"$&'()*+,-.;=_`{}~", "stun:\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u000B\u000C\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u007F!\"$%&'()*+,-.;=_`{}~", "stun:h\to\ns\rt:9\t0\n0\r0", 'stun:1.2.3.4.', 'stun:192.168.257', '192.168.257.com', 'stun:256', 'stun:256.com', 'stun:999999999', 'stun:0xffffffff',
// Spec say the following are valid,
// but that sounds like a bug
Copy link
Contributor

Choose a reason for hiding this comment

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

RFC 7064 section 3.1 says that they are not valid (no hierarchical part in the ABNF following "host/port" - please disambiguate "spec" here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I meant the WebRTC API - clarified

@dontcallmedom
Copy link
Contributor Author

@alvestrand
Copy link
Contributor

It's possible that we need to specify the steps as:

  • If the URI fails to validate according to the URI spec, throw a syntax error
  • If the scheme is stun: or stuns: and it fails to validate according to RFC 7064, thorw a syntax error
  • If the scheme is turn: or turns: and it fails to validate according to RFC , throw a syntax error

But that's for the webrtc-pc spec to disambiguate.

@dontcallmedom
Copy link
Contributor Author

I'll refrain from merging for now since I expect we will want to fix the remaining inconsistencies with RFC parsing

dontcallmedom added a commit to w3c/webrtc-pc that referenced this pull request Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants