-
Notifications
You must be signed in to change notification settings - Fork 214
Closed
Description
sysPass Version
3.2.6
Describe the bug
After updating to version 3.2.6 we have detected that some URLs are displayed incorrectly on the search screen. For instance, if we set the URL https://www.google.com in the account, we can see on the search screen the value https%3A%2F%2Fwww.google.com and the link is https://syspass-url/https%3A%2F%2Fwww.google.com
I suppose the problem is related with this function:
/**
* @param string $url
*
* @return string
*/
public static function getSafeUrl(string $url): string
{
if (preg_match('#^((?:https?|ftp|ssh|rdp)://[\w._-]+/)(.*)#', $url, $urlParts)
&& count($urlParts) === 3) {
return $urlParts[1].urlencode($urlParts[2]);
}
return urlencode($url);
}
The regexp expects the url has 3 parts, and if it doesn't finish with /
or /something
, it doesn't match.
To Reproduce
Steps to reproduce the behavior:
- Set an URL in an account without context path, for instance https://www.google.com
- Goto search screen and locate the account
- Look at the URL and the link
- See error
Expected behavior
URLs should be parsed correctly regardless of whether they end with / or not
Screenshots
Metadata
Metadata
Assignees
Labels
No labels