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

Make sure the URL installer does not allow other schemas then http and https #32087

Merged
merged 5 commits into from
Jan 24, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions administrator/components/com_installer/models/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,16 @@ protected function _getPackageFromUrl()
return false;
}

// We only allow http & https here
$uri = new JUri($url);

if (!in_array($uri->getScheme(), ['http', 'https']))
{
JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL_SCHEMA'));
zero-24 marked this conversation as resolved.
Show resolved Hide resolved

return false;
}

// Handle updater XML file case:
if (preg_match('/\.xml\s*$/', $url))
{
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.com_installer.ini
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ COM_INSTALLER_MSG_DISCOVER_PURGEDDISCOVEREDEXTENSIONS="Cleared discovered extens
COM_INSTALLER_MSG_ERROR_CANT_CONNECT_TO_UPDATESERVER="Can't connect to %s"
COM_INSTALLER_MSG_INSTALL_ENTER_A_URL="Please enter a URL"
COM_INSTALLER_MSG_INSTALL_INVALID_URL="Invalid URL"
COM_INSTALLER_MSG_INSTALL_INVALID_URL_SCHEME="Please enter a valid URL starting with http or https."
COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED="No file selected."
COM_INSTALLER_MSG_INSTALL_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE="Path does not have a valid package."
COM_INSTALLER_MSG_INSTALL_PLEASE_ENTER_A_PACKAGE_DIRECTORY="Please enter a package folder."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@

PLG_INSTALLER_URLINSTALLER_BUTTON="Check and Install"
PLG_INSTALLER_URLINSTALLER_INSTALLER_URLFOLDERINSTALLER="Installer - Install from URL."
PLG_INSTALLER_URLINSTALLER_NO_URL="Please enter a URL."
PLG_INSTALLER_URLINSTALLER_PLUGIN_XML_DESCRIPTION="This plugin allows you to install packages from a URL."
PLG_INSTALLER_URLINSTALLER_TEXT="Install from URL"
13 changes: 3 additions & 10 deletions plugins/installer/urlinstaller/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,9 @@
{
var form = document.getElementById("adminForm");

// do field validation
if (form.install_url.value == "" || form.install_url.value == "http://" || form.install_url.value == "https://") {
alert("' . JText::_('PLG_INSTALLER_URLINSTALLER_NO_URL', true) . '");
}
else
{
JoomlaInstaller.showLoading();
form.installtype.value = "url"
form.submit();
}
JoomlaInstaller.showLoading();
form.installtype.value = "url"
form.submit();
};
');
?>
Expand Down