Skip to content

Conversation

@iliaal
Copy link
Contributor

@iliaal iliaal commented Oct 27, 2015

Added validation to parse_url() to prohibit restricted characters inside login/pass components based on RFC3986

@jpauli
Copy link
Member

jpauli commented Dec 22, 2015

This has been merged against master and will be part of PHP 7.1

@jpauli jpauli closed this Dec 22, 2015
@smalyshev smalyshev added the Bug label Sep 29, 2016
@smalyshev
Copy link
Contributor

@jpauli any reason why it wasn't merged in 5.6 and 7.0?

@jpauli
Copy link
Member

jpauli commented Sep 29, 2016

Well, that broke tests, that needed tests change, so API break, so I did not commit that to stable branches

@smalyshev
Copy link
Contributor

If it fixes RFC incompatibility, then I think it should be backported.

@jpauli
Copy link
Member

jpauli commented Oct 3, 2016

Ok then I suggest you cherry-pick the needed commits if you want to

@nikic
Copy link
Member

nikic commented Oct 7, 2016

Multiple people have reported this as a regression here: https://bugs.php.net/bug.php?id=71822&edit=1

Given the ML discussion that has recently come up on implementing a compliant parse_url() alternative, I think it would be best to revert this change from all branches to avoid unnecessary BC breaks. Don't forget that historically parse_url() has always been obliging in parsing incomplete and invalid URLs, so starting to enforce additional checks at this point seems questionable to me.

/cc @weltling @dshafik

@smalyshev
Copy link
Contributor

OK, let's revert it. But see https://bugs.php.net/bug.php?id=73192 then. I think it's the issue we need to address.

@nikic
Copy link
Member

nikic commented Oct 7, 2016

@smalyshev Hm, I see. I think we should do as the reporter suggests (if I understand it correctly) and make sure that host/password/etc are never recognized after the first ? or #, as these should always start query or fragment.

@nikic
Copy link
Member

nikic commented Oct 7, 2016

The problem is in

if (!(p = memchr(s, '/', (ue - s)))) {
. e should be set to the first of /, ? or #, but the code will always set it to the / position if / is present at all.

@nikic
Copy link
Member

nikic commented Oct 7, 2016

Reverted in 1c468ee and bc3a0b8. Fixed the sec bug with b061fa9. This also caused some test fallout, but seems limited to completely broken URLs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants