Skip to content

[4.0] Add locked field to extensions table, prevent uninstalling core extensions, restructure protected extension list#28462

Merged
wilsonge merged 4 commits intojoomla:4.0-devfrom
Quy:17219-locked
Mar 31, 2020
Merged

[4.0] Add locked field to extensions table, prevent uninstalling core extensions, restructure protected extension list#28462
wilsonge merged 4 commits intojoomla:4.0-devfrom
Quy:17219-locked

Conversation

@Quy
Copy link
Contributor

@Quy Quy commented Mar 26, 2020

Porting of PR #17219 to J4

All credits to @mbabker. Thank you!

Thanks @richard67 for updating the SQL files.

Text below copied from PR #17219.

Summary of Changes

This is PR #13037. See the original PR for added context and past conversation.

The long and short is this adds a new field, locked, to the extensions table, and splits the current definition of the protected field. This also updates the protected extension list to make the list only include admin components, core libraries, and the files extension that Joomla tracks itself with (this means all modules and plugins are now unprotected and can be enabled/disabled consistently).

Current:

  • protected indicates an extension which cannot be disabled or uninstalled

New:

  • protected indicates an extension which cannot be disabled

  • locked indicates an extension which cannot be uninstalled

Why This Distinction Matters

Uninstalling core extensions can be problematic, and honestly it's not very effective given our current packaging and upgrading solutions. Even if you do uninstall the extensions, they end up back on your site's filesystem during the update process because we don't make the package extraction step aware of the database and inherently the installed extensions. Also, uninstalling components takes their tables with them, and if an update includes a SQL delta for one of those tables, it causes the update to fail over. So we should take an extra step to protect users from doing things that could be dangerous for their sites. Next, an uninstallable extension should not mean that the extension must be enabled. The only extensions which should be protected are those which if disabled would critically bring down the site, every other aspect of the extension listing should be controllable by the site administrator.

Testing Instructions

It needs to test the same changes in 2 scenarios:

  1. New installation with this PR applied.
  2. Update from 3.10-dev or 3.10-alpha to J4 + this PR with a patched updated package.

Then, after the new installation or the update, it needs to test in both cases:

  • The user should be unable to uninstall any core extension (on a correct install this is any extension with an ID less than 10000).
  • The user should not be able to disable extensions which are critical to the management of the site (i.e. the extension manager, plugin manager, or update component, any of the libraries, or Joomla files extension) or are coupled to the core application stack (i.e. com_categories or com_content). All other extensions should be able to be disabled through the Extension Manager interface.

For scenario 1 new installation, apply the patch of this PR to a clean 4.0-dev branch when having a git clone, or use the patched full package download for this PR (see below).

For scenario 2, use the patched update package download for this PR (see below).

You can find a link to the downoads page when expanding the test results at the bottom of this PR on GitHub, if not already expanded:
j4-pr-28462-link-to-packages-1

j4-pr-28462-link-to-packages-2

The link leads to a download page where you can donwnload patched installation and update packages for this PR. By the commit number you can check if they fit to the last commit of this PR, i.e. they are up to date:
j4-pr-28462-link-to-packages-3

There is also a custom update URL given for the update package so you can use the online update with that custom URL.

Btw. this is a standard feature for new or newly modified PR's on the 4.0-dev branch, so it can be used in the same way for testing other PR's, too.

Documentation Changes Required

We should probably add a page explaining the various extension states and what these columns exist for if one doesn't already exist.

@alikon
Copy link
Contributor

alikon commented Mar 26, 2020

i guess we need to add com_privacy & com_actionlogs to the list of core component

@alikon
Copy link
Contributor

alikon commented Mar 26, 2020

plus com_csp

@richard67
Copy link
Member

And someone has to check PostgreSQL, system tests for postgres are failing in drone. I don't have time now.

@richard67
Copy link
Member

richard67 commented Mar 26, 2020

List of core extension here should be up to date, so just use this as master: https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Extension/ExtensionHelper.php#L46.

(posted wrong link for staging before, now is correct 4.0-dev)

@brianteeman
Copy link
Contributor

it seems crazy to me that we have one hard coded list already and to add a second one is even more bizarre

@richard67
Copy link
Member

@Quy See Quy#1 for fixing system-test-postgresql in drone.

@richard67
Copy link
Member

@Quy I think @alikon is right, they are missing in the update sql's.

…in Drone and update to 4.0-dev (#1)

* [RTL] Fix position of close button in modal

* Fix error with PostgreSQL installation

* Adjust update sql to latest components and modules as in joomla.sql

* Adjust update sql to latest plugins as in joomla.sql

* SQL CS - use spaces in IN lists

* Revert unrelated scss change

Co-authored-by: wilsonge <georgejameswilson@googlemail.com>
@richard67
Copy link
Member

@alikon @wilsonge Update sql is up to date now 😄

@richard67
Copy link
Member

What remains to be done is to check and if necessary update the list of core extensions in section "Now protect from disabling essential core extensions" at the bottom of the update sql. These values for protected and enabled should be the same as in joomla.sql I think.

@richard67
Copy link
Member

What remains to be done is to check and if necessary update the list of core extensions in section "Now protect from disabling essential core extensions" at the bottom of the update sql. These values for protected and enabled should be the same as in joomla.sql I think.

@Quy See Quy#2.

@richard67
Copy link
Member

@Quy You can remove the sentence about SQL files to be reviewed from the description since I’ve reviewed them.

@ReLater
Copy link
Contributor

ReLater commented Mar 29, 2020

I have tested this item ✅ successfully on 793bd1d

@ReLater
Copy link
Contributor

ReLater commented Mar 29, 2020

Addition to test: #28462 (comment)

=============
System Information

php: Linux dd46134 4.15.0-91-generic #92~16.04.1-Ubuntu SMP Fri Feb 28 14:57:22 UTC 2020 x86_64
dbserver: mysql
dbversion: 5.7.28-nmm1-log
dbcollation: utf8_general_ci
dbconnectioncollation: utf8mb4_general_ci
dbconnectionencryption:
dbconnencryptsupported: true
phpversion: 7.4.2
server: Apache
sapi_name: fpm-fcgi
version: Joomla! 4.0.0-beta1-dev+pr.28462 Development [ Mañana ] 17-October-2019 20:21 GMT
useragent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

@astridx
Copy link
Contributor

astridx commented Mar 29, 2020

Scenario 1 Mysql and Postgres

  1. I applied this patch and made a new installation.
  2. I tried to uninstall a lot of core extensions and get all the time the message that it is not possible.
    Extensions  Manage   test   Administration(3)
  3. Then I installed one of my extensions. Uninstalling this extension was possible.

By the way I wonder why there is sometimes a icon that shows to you, that the extension is protected and sometimes this icon is missing. I know that this icon is for protecting publishing and unpublished. But it is a little bit confusing for new Joomlers.
Extensions  Manage   test   Administration(2)

System Information
php: Linux astrid-TravelMate-5760G 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64
dbserver: mysql
dbversion: 5.7.29-0ubuntu0.18.04.1
dbcollation: utf8mb4_unicode_ci
dbconnectioncollation: utf8mb4_general_ci
dbconnectionencryption:
dbconnencryptsupported: true
phpversion: 7.2.28-3+ubuntu18.04.1+deb.sury.org+1
server: Apache/2.4.29 (Ubuntu)
sapi_name: apache2handler
version: Joomla! 4.0.0-beta1-dev+pr.28462 Development [ Mañana ] 17-October-2019 20:21 GMT
useragent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

System Information
php: Linux astrid-TravelMate-5760G 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64
dbserver: postgresql
dbversion: 12.2 (Ubuntu 12.2-2.pgdg18.04+1)
dbcollation: en_GB.UTF-8
dbconnectioncollation: en_GB.UTF-8
dbconnectionencryption: TLSv1.3 (TLS_AES_256_GCM_SHA384)
dbconnencryptsupported: true
phpversion: 7.2.29-1+ubuntu18.04.1+deb.sury.org+1
server: Apache/2.4.29 (Ubuntu)
sapi_name: apache2handler
version: Joomla! 4.0.0-beta1-dev+pr.28462 Development [ Mañana ] 17-October-2019 20:21 GMT
useragent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

@Quy
Copy link
Contributor Author

Quy commented Mar 29, 2020

@astridx Please read Why This Distinction Matters section for explanation.

@astridx
Copy link
Contributor

astridx commented Mar 29, 2020

Scenario 2 MySQL and Postgres

  1. I downloaded the current nightly build of 3.10 from here: https://developer.joomla.org/nightly-builds.html
  2. After that I made an update with the zip of this patch: Joomla_4.0.0-beta1-dev+pr.28462-Development-Full_Package.zip
  3. I tried to uninstall a few core extensions. It was not possible.
  4. I installed my own extension and I was allowed to uninstall it.

By the way: After the update I saw this errors using postgres and using mysql.
Joomla Update   test   Administration(1)
Extensions  Manage   test   Administration(5)

System Information
php: Linux astrid-TravelMate-5760G 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64
dbserver: postgresql
dbversion: 12.2 (Ubuntu 12.2-2.pgdg18.04+1)
dbcollation: en_GB.UTF-8
dbconnectioncollation: en_GB.UTF-8
dbconnectionencryption: TLSv1.3 (TLS_AES_256_GCM_SHA384)
dbconnencryptsupported: true
phpversion: 7.2.29-1+ubuntu18.04.1+deb.sury.org+1
server: Apache/2.4.29 (Ubuntu)
sapi_name: apache2handler
version: Joomla! 4.0.0-beta1-dev+pr.28462 Development [ Mañana ] 17-October-2019 20:21 GMT
useragent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0
php: Linux astrid-TravelMate-5760G 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64
dbserver: postgresql
dbversion: 12.2 (Ubuntu 12.2-2.pgdg18.04+1)
dbcollation: en_GB.UTF-8
dbconnectioncollation: en_GB.UTF-8
dbconnectionencryption: TLSv1.3 (TLS_AES_256_GCM_SHA384)
dbconnencryptsupported: true
phpversion: 7.2.29-1+ubuntu18.04.1+deb.sury.org+1
server: Apache/2.4.29 (Ubuntu)
sapi_name: apache2handler
version: Joomla! 4.0.0-beta1-dev+pr.28462 Development [ Mañana ] 17-October-2019 20:21 GMT
useragent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

System information
php: Linux astrid-TravelMate-5760G 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64
dbserver: mysql
dbversion: 5.7.29-0ubuntu0.18.04.1
dbcollation: utf8_general_ci
dbconnectioncollation: utf8mb4_general_ci
dbconnectionencryption:
dbconnencryptsupported: true
phpversion: 7.2.29-1+ubuntu18.04.1+deb.sury.org+1
server: Apache/2.4.29 (Ubuntu)
sapi_name: apache2handler
version: Joomla! 4.0.0-beta1-dev+pr.28462 Development [ Mañana ] 17-October-2019 20:21 GMT
useragent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

@Quy
Copy link
Contributor Author

Quy commented Mar 29, 2020

#28510 For the first issue.
#28505 Fixed for the second issue.

@astridx
Copy link
Contributor

astridx commented Mar 29, 2020

Que #28510 For the first issue.
#28505 Fixed for the second issue.

Thank you. I was just thinking about opening new issues :)

@astridx
Copy link
Contributor

astridx commented Mar 29, 2020

I have tested this item ✅ successfully on 793bd1d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28462.

@Quy
Copy link
Contributor Author

Quy commented Mar 29, 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28462.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Mar 29, 2020
@wilsonge wilsonge merged commit 81406e4 into joomla:4.0-dev Mar 31, 2020
@wilsonge
Copy link
Contributor

Thanks guys!

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Mar 31, 2020
@wilsonge wilsonge added this to the Joomla 4.0 milestone Mar 31, 2020
@infograf768
Copy link
Member

infograf768 commented Apr 1, 2020

Any reason to lock the Language Switcher module and not the Language Filter system plugin?

@infograf768
Copy link
Member

See issue #28527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants