No Code Attached Yet
avatar sanus70
sanus70
22 Aug 2021

Hi all,

since J4 will use the checksum whil updating an extension, the current implementation runs in a problem cause before the update is downloaded, Joomla will re-request the manifest file. The problem is, that this is done without the extra_query key attached, wich results in a manifest file for non-commercial updates (with different checksum).
After the request of the manifest, the updater requests the download with the extra_query key. At this point, there is a sha256 checksum for a free extension and a downloaded commercial zip with other checksum.
Finally the update fails with: "The checksum verification failed. Please make sure you are using the correct update server!"

Solution:
` public function update($uids, $minimumStability = Updater::STABILITY_STABLE)
{
$result = true;

	foreach ($uids as $uid)
	{
		$update = new Update;
		$instance = new \Joomla\CMS\Table\Update($this->getDbo());

		if (!$instance->load($uid))
		{
			// Update no longer available, maybe already updated by a package.
			continue;
		}
if ($extra_query = $updateSiteInstance->extra_query) { $instance->detailsurl .= (strpos($url, '?') === false) ? '?' : '&'; $instance->detailsurl .= $extra_query; } $update->loadFromXml($instance->detailsurl, $minimumStability); ... `

Append the key for the manifest request also.

Kind regards
Christian

avatar sanus70 sanus70 - open - 22 Aug 2021
avatar joomla-cms-bot joomla-cms-bot - change - 22 Aug 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 22 Aug 2021
avatar PhilETaylor
PhilETaylor - comment - 22 Aug 2021

Hmmm... maybe you should use different update streams for different licensed products? One for free and one for commercial?

avatar sanus70
sanus70 - comment - 22 Aug 2021

There is no reason why the key is not appended to the request at that stage.

Different update sreams can't be a solution, since the key is used to identify a valid update of a paying customer. Without the key, you just have to use the update link, regardless if you are allowed to update or not. Not a solution.

avatar zero-24
zero-24 - comment - 22 Aug 2021

@sanus70 please send us a PR against the 3.10-dev branch so it can be patched in upcomming 3.10 and 4.0 releases ?

avatar PhilETaylor
PhilETaylor - comment - 22 Aug 2021

If by adding a download Id you get different hashes, then you are distributing different products. If the products were the same the hashes would be equal. Two different products should have two different update streams.

avatar sanus70
sanus70 - comment - 22 Aug 2021

Maybe I can't see it but even with different streams the problem persists.
Look:

  1. Joomla looks if an updat is availabel: + key
    -> mainfest file with the commercial update is sent.
  2. Joomla requests for the update package.
      1. step: no key
        -> update server sees no key, so he will fallback to free version
      1. step: for package (given in the previous request) with key
        -> update server sees a key, so he will send the commerial version
      1. Error with missmatch of sha

Without the use of a key, the manifest file will point to the last commercial version available, regardless of the user is allowed or not.
Assuming this, the updater will work since the sha hashes are equal.
Now, the user is no longer allowed to update (end of subscription). Since the key is not in use, he will always get the latest version, cause the update server did not know that he is no longer allowed to update. And there is more to note. Everybody is able to share the update urls and get the packages for free.
At J3 times, this was not a problem cause J3 does not checked against the manifest. Since J4 will check the sha, the manifest has to be the correct one for free/ commercial updates.
Do you see the point?

avatar PhilETaylor
PhilETaylor - comment - 22 Aug 2021

You fundamentally misunderstand how download ids are meant to be used.

If no id is provided you should return a 403 Forbidden when Joomla attempts to download the commercial licensed zip file specified in the xml.

Take a look at the reference product which would be Akeeba Backup Professional and how com_ars (akeeba release system) works.

Yes it would be easy to add the download id to the xml, but this is not how the whole process was designed to work.

avatar sanus70
sanus70 - comment - 22 Aug 2021

We will see... If I am right, this problem will be seen from many third parties ;-)
It's not a problem of sending the zip or 403, its the problem explained above...

avatar alikon alikon - change - 23 Aug 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-08-23 07:18:51
Closed_By alikon
avatar alikon alikon - close - 23 Aug 2021
avatar alikon
alikon - comment - 23 Aug 2021

closing as we have a PR #35306

avatar Ruud68
Ruud68 - comment - 23 Aug 2021

You fundamentally misunderstand how download ids are meant to be used.

If no id is provided you should return a 403 Forbidden when Joomla attempts to download the commercial licensed zip file specified in the xml.

Take a look at the reference product which would be Akeeba Backup Professional and how com_ars (akeeba release system) works.

Yes it would be easy to add the download id to the xml, but this is not how the whole process was designed to work.

Phil is (IMO) right: download key is used to authorize a download (because automated downloading cannot use username / password).
This is also how ochSubscriptions (for offering downloads) works.
An extension is either paid for or free: these are two versions with their own manifest file and update servers.
If you can download a commercial version without a download key / login in just by following a URL then your distribution extension does not have it's security / authorization in order.

@sanus70 what extension are you using for distributing?

avatar PhilETaylor
PhilETaylor - comment - 23 Aug 2021

see nic's comments - especially about CDN busting in the PR #35306

avatar richard67
richard67 - comment - 23 Aug 2021

Maybe it would be better to continue the discussion in the open PR #35306 and not in the closed issue here?

avatar sanus70
sanus70 - comment - 23 Aug 2021

@Ruud68 - Using my own ;-)

Add a Comment

Login with GitHub to post a comment