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

Disallow backtick in host #511

Open
greenfork opened this issue May 24, 2023 · 1 comment
Open

Disallow backtick in host #511

greenfork opened this issue May 24, 2023 · 1 comment

Comments

@greenfork
Copy link

greenfork commented May 24, 2023

The tilde backtick symbol (`) seems allowed in the host. In the spec it is not allowed:

host          = IP-literal / IPv4address / reg-name
reg-name      = *( unreserved / pct-encoded / sub-delims )
unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
sub-delims    = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
require "addressable"

Addressable::URI.parse("htttp://`www.example.com")
#=> #<Addressable::URI:0x3c URI:htttp://`www.example.com>
@dentarg
Copy link
Collaborator

dentarg commented May 24, 2023

Yeah this looks like a bug

uri blows up on it:

irb(main):004:0> URI.parse("http://`www.example.com")
/Users/dentarg/.rubies/3.2.2/lib/ruby/3.2.0/uri/rfc3986_parser.rb:66:in `split': bad URI(is not URI?): "http://`www.example.com" (URI::InvalidURIError)
	from /Users/dentarg/.rubies/3.2.2/lib/ruby/3.2.0/uri/rfc3986_parser.rb:71:in `parse'
	from /Users/dentarg/.rubies/3.2.2/lib/ruby/3.2.0/uri/common.rb:193:in `parse'
	from (irb):4:in `<main>'
	from /Users/dentarg/.rubies/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
	from /Users/dentarg/.rubies/3.2.2/bin/irb:25:in `load'
	from /Users/dentarg/.rubies/3.2.2/bin/irb:25:in `<main>'

@dentarg dentarg changed the title Disallow tilde in host Disallow backtick in host Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants