Skip to content

[4.0] Checksum extensions - GSoC Expand Extensions Manager#17555

Closed
NunoLopesPT wants to merge 14 commits intojoomla:4.0-devfrom
NunoLopesPT:checksum_extensions
Closed

[4.0] Checksum extensions - GSoC Expand Extensions Manager#17555
NunoLopesPT wants to merge 14 commits intojoomla:4.0-devfrom
NunoLopesPT:checksum_extensions

Conversation

@NunoLopesPT
Copy link
Copy Markdown
Contributor

Introduction

Currently there is no security when downloading files from update sites or uploading a package, with this feature the main goal is to make sure that only the original files are downloaded and installed by checking the integrity of the package(SHA256, SHA1 and MD5 Hashes), lowering the risk of getting infected files that can risk the user.

Summary of Changes

This verification will only be made for installing packages from URL or uploading a package file in the Install view, this is how the process of verification will happen:
screenshot from 2017-08-08 16-53-23
(note: I forgot to place the SHA-256 hash here)

Testing Instructions

We will have 3 packages to test:

Package with the correct hashes in the update server manifest:
component_joomla.zip

Here is the update server manifest:
https://www.jah-tz.de/downloads/core/gsoc17/extension.xml

Package with the wrong hashes:
component_joomla_wrong_checksum.zip

I remember here that without the Force Install checked you won't install the extension

Update server manifest:
https://www.jah-tz.de/downloads/core/gsoc17/extension_wrong_hash.xml

Package without hashes:
component_joomla_no_checksum.zip

Update server manifest:
https://www.jah-tz.de/downloads/core/gsoc17/extension_no_chechsum.xml

Expected result

Case 1 - File Checksum OK:
A success message when the checksums are equal

Case 2 - File Checksum Failed:
A danger message when the checksums are not equal and the user does not want to force the installation, redirecting back to the view without installing the extension

Case 3 - File Checksum Failed but user wants to force install:
There will be a checkbox on the upload package and install from URL tab where the user can check if he really wants to install the extension even if the Checksum fails.
A warning if the checksum fails will appear.

Case 4 - No checksum found:
If the extension has no update site or no checksums (MD5, SHA1 or SHA256 tags) are showed in the update site manifest a warning should appear to make sure the users know that no security verification was provided in the extension package.
A info message will appear that no Hashes are available.

Actual result

Currently there is no security or information related to this

Documentation Changes Required

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.0-dev labels Aug 16, 2017
@NunoLopesPT NunoLopesPT changed the title Checksum extensions [4.0] Checksum extensions - GSoC Expand Extensions Manager Aug 16, 2017
COM_INSTALLER_HEADING_UPDATESITE_NAME_DESC="Update Site descending"
COM_INSTALLER_HEADING_UPDATESITEID="ID"
COM_INSTALLER_INSTALL_BUTTON="Install"
COM_INSTALLER_INSTALL_CHECKSUM_NOT_FOUND="There were no checksums provided in the package"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a period at the end of the sentence

COM_INSTALLER_INSTALL_CHECKSUM_NOT_FOUND="There were no checksums provided in the package"
COM_INSTALLER_INSTALL_CHECKSUM_WRONG="File Checksum Failed"
COM_INSTALLER_INSTALL_CHECKSUM_CORRECT="File Checksum OK"
COM_INSTALLER_INSTALL_CHECKSUM_WRONG_NO_INSTALL="File Checksum Failed, Extension was not installed"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a period at the end of the sentence


PLG_INSTALLER_URLINSTALLER_BUTTON="Check and Install"
PLG_INSTALLER_URLINSTALLER_FORCE_INSTALL="Force Install"
PLG_INSTALLER_URLINSTALLER_FORCE_INSTALL_DETAILS="Forces the installation of the package even if it is not trusted"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a period at the end of the sentence

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Aug 19, 2017

a light port to 3.8 #17619

@brianteeman
Copy link
Copy Markdown
Contributor

The provided hash lets you double-check that the file you downloaded was not corrupted accidentally in transit, or that the file you downloaded from another source (a faster mirror or github etc) is the same as the file available for download at the original website where the hash is published

COM_INSTALLER_INSTALL_BUTTON="Install"
COM_INSTALLER_INSTALL_CHECKSUM_NOT_FOUND="There were no checksums provided in the package."
COM_INSTALLER_INSTALL_CHECKSUM_WRONG="File Checksum Failed"
COM_INSTALLER_INSTALL_CHECKSUM_CORRECT="File Checksum OK"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort alpha order.


<div id="uploader-wrapper">
<div class="control-group">
<label for="force_install" class="control-label" title="<?php echo \JText::_('PLG_INSTALLER_URLINSTALLER_FORCE_INSTALL_DETAILS') ?>">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add semicolon after echo \JText::_('PLG_INSTALLER_URLINSTALLER_FORCE_INSTALL_DETAILS')

</div>
</div>
<div class="control-group">
<label for="force_install" class="control-label" title="<?php echo \JText::_('PLG_INSTALLER_URLINSTALLER_FORCE_INSTALL_DETAILS') ?>">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add semicolon after echo \JText::_('PLG_INSTALLER_URLINSTALLER_FORCE_INSTALL_DETAILS')

foreach ($hashes as $hash)
{
$hashPackage = hash_file($hash, $packagefile);
$hashRemote = $updateServerManifest->$hash->_data;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a hash missing you get PHP Errors. To solve this above this line add

// If there is no hashes set for an extension continue
if (!property_exists($updateServerManifest, $hash))
{
	continue;
}

@wilsonge
Copy link
Copy Markdown
Contributor

  1. Can we fix conflicts please :)
  2. The bad checksum extension still installs (we talked about this after the panel - all the checksums in that file aren't the ones you check for)

@ghost ghost removed the J4 Issue label Apr 13, 2019
@schultz-it-solutions
Copy link
Copy Markdown
Contributor

The Update Server manifests seem to no longer exist
https://www.jah-tz.de/downloads/core/gsoc17/extension.xml

Could you please direct me to an example (or description) of the changes in the manifest.

@sanderpotjer
Copy link
Copy Markdown
Member

@roland-d while working on the extension manager features, can you please update this PR as well (or create a new one).

@roland-d roland-d self-assigned this May 5, 2019
COM_INSTALLER_HEADING_UPDATESITE_NAME_DESC="Update Site descending"
COM_INSTALLER_HEADING_UPDATESITEID="ID"
COM_INSTALLER_INSTALL_BUTTON="Install"
COM_INSTALLER_INSTALL_CHECKSUM_CORRECT="File Checksum OK"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String not used.

{
$app = \JFactory::getApplication();

$hashes = array("sha256", "sha384", "sha512");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$hashes = array("sha256", "sha384", "sha512");
$hashes = ['sha256', 'sha384', 'sha512'];

@uglyeoin
Copy link
Copy Markdown
Contributor

Have @wilsonge comments been taken account of? Is this ready to test yet?

@wilsonge
Copy link
Copy Markdown
Contributor

No no use in testing this right now.

@roland-d
Copy link
Copy Markdown
Contributor

roland-d commented Aug 1, 2020

This can be closed and picked up in another PR if someone is interested.

@roland-d roland-d closed this Aug 1, 2020
@roland-d roland-d deleted the checksum_extensions branch August 1, 2020 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants