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

$sanitizer->url allows invalid URLs #2062

Closed
FerdiAgrio opened this issue Jul 12, 2017 · 2 comments
Closed

$sanitizer->url allows invalid URLs #2062

FerdiAgrio opened this issue Jul 12, 2017 · 2 comments

Comments

@FerdiAgrio
Copy link

When checking a bunch of URLs, I came past an odd example of an 'URL' which passed the $sanitizer->url() method. Basically I'm only checking a random word like 'processwire' with the extra option to disallow relative-URLs and the need of scheme 'http' or 'https'.
Example:
$sanitizer->url('processwire', array('allowRelative' => false,'allowSchemes' => array('http', 'https')));

I tried to narrow it down:
$scheme = parse_url($value, PHP_URL_SCHEME); if($scheme !== false && strlen($scheme)) {...}
which didn't pass (correct, returns null)

Further on it checks for incorrect $scheme:
if(!$scheme) {...}

and checks the option 'allowRelative':
if($options['allowRelative']) {...}

since the value is 'processwire' we move to the else which says:
// relative urls aren't allowed, so add the scheme/protocol and validate $value = $this->filterValidateURL("http://$value", $options);
...which somehow passes

It would be nice if somebody can clear this up for me. Thanks in advance.

@LostKobrakai
Copy link

This is the old legacy repo of processwire. See here about where to submit your issue:
#2051

@FerdiAgrio
Copy link
Author

FerdiAgrio commented Jul 12, 2017

Damn bookmarks need updating! Tnx!
Although I won't post it - found a satisfying answer here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants