? ? ? Success

User tests: Successful: Unsuccessful:

avatar LivioCavallo
LivioCavallo
22 Aug 2017

Summary of Changes

Perform an additional authorization check at the category level in com_content edit view file: view.html.php .
This blocks an unauthorized user from accessing the editor in some circumstancies when he does not have "Create" permissions for that category.

Testing Instructions

Create a new User Group: "Manage Category ONE" with 'Public' parent group.
In System / Global Configuration set Permission to allow "Manage Category ONE" group to Login into site.
Create new user 'User1' as member of this group.
Create a new article category "ONE" and set permissions so that "Manage Category ONE" group is allowed to "Create".
Create a new article category "TOP SECRET" and check that "Manage Category ONE" group has no permissions to "Create" in it.
Now create a menuitem, "Create Top Secret", to submit a new article; set Options so that default category "TOP SECRET" is default.

Login as "User1" into frontend and "Create Top Secret".

Expected result

User is not authorized, not having rights to "Create" in "Top Secret" category.

Actual result

User is allowed to enter the editor! He can even browse images folder.

Notes

In J!3.4.4 (and I suppose in some later versions) the user was allowed to save the article!
In J!3.7.5 (I suppose starting from some previous versions) when he clicks on "Save" the operation is blocked with error; this mitigates the problem.
Anyway I think that accessing the editor (though the most dangerous functionalities are disabled) is not a "good thing": the user should be blocked as soon as he tries to access a resource he is not authorized to use, not later, when he tries to close (save) that resource.

avatar joomla-cms-bot joomla-cms-bot - change - 22 Aug 2017
Category Front End com_content
avatar LivioCavallo LivioCavallo - open - 22 Aug 2017
avatar LivioCavallo LivioCavallo - change - 22 Aug 2017
Status New Pending
avatar LivioCavallo LivioCavallo - change - 22 Aug 2017
Labels Added: ?
avatar ggppdk
ggppdk - comment - 22 Aug 2017

Also i noticed that parameter name is 'Default category'
but parameter description says:

If set to 'Yes', this page will only let you create articles in the category selected below.

so "Default category" does not sound like best choice
instead of "Default category" a proper parameter name would be

  • Limit category
  • Category Limitation
  • Specific category

submit_new_article

avatar LivioCavallo
LivioCavallo - comment - 22 Aug 2017

Constrained / Bound category?

avatar joomla-cms-bot joomla-cms-bot - change - 23 Aug 2017
Category Front End com_content Administration Language & Strings Front End com_content
avatar LivioCavallo LivioCavallo - change - 23 Aug 2017
Labels Added: ?
avatar infograf768
infograf768 - comment - 23 Aug 2017

Constrained is hard to translate.
"Specific category" reads better imho.

avatar ggppdk
ggppdk - comment - 23 Aug 2017

This is more an UX fix , that an security fix (e.g. the form display of custom fields of an non-accessible category are revealed),

i say UX because, imagine someone spending 10, 20 minutes to fill in the form and then clicking save, to discover that has no access to save the form, some real frustration

avatar LivioCavallo
LivioCavallo - comment - 24 Aug 2017

So should I change name to: "UX fix: ..." ?
(Or programmer safety? ? )

avatar infograf768
infograf768 - comment - 24 Aug 2017

Hmm, found a bug, unrelated to this PR.
One can save a Create Article menu item, settting "Default Category" to Yes and NOT filling the "Choose a Category" field.
In frontend, using such a setting forces to save the article created in the category with the smallest Id. catid param is therefore empty.

Therefore I suggest to use

$catid = $this->state->params->get('catid');
if (!empty($catid)
{
   $authorised = $user->authorise('core.create', 'com_content.category.' . $catid);
etc.

as I could not find a way to solve that bug.

avatar LivioCavallo
LivioCavallo - comment - 24 Aug 2017

Oh! Thanks. Fixed.

There is a way to add client-side field validation to params form field in backend?
In this case it would be useful something like 'showon:', let's say 'requireon:'.

avatar LivioCavallo
LivioCavallo - comment - 24 Aug 2017

It seems there were problems with drone and appveyor, but I don't find a way to restart them. Is it normal?
Or there is really any error?

avatar alikon
alikon - comment - 24 Aug 2017

i think we still need to manage properly the issue referenced by @infograf768, your fix just show Error save not permitted but maybe is better to open a different issue for that

avatar alikon alikon - test_item - 24 Aug 2017 - Tested successfully
avatar alikon
alikon - comment - 24 Aug 2017

I have tested this item successfully on 175a328

as per pr testing info


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

avatar alikon
alikon - comment - 24 Aug 2017

I have tested this item successfully on 175a328

as per pr testing info


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

avatar LivioCavallo
LivioCavallo - comment - 24 Aug 2017

You are right @alikon.
Now we have a new issue: #17708.

avatar ggppdk
ggppdk - comment - 25 Aug 2017

@LivioCavallo

I have made PRs against you patching both places, that 'enable_category' is used

components/com_content/views/form/view.html.php
and
components/com_content/models/form.php

now code will work properly even if user has set 'enable_category' to YES and did not select category

  • it will now behave as if 'enable_category' is NO

fixing is #17708 is now not needed

avatar LivioCavallo
LivioCavallo - comment - 25 Aug 2017

Thanks @ggppdk, I like your idea, I think it's a good workaround. I merged it.
Anyway I think that the "Selected category" should be 'required' if Default category is ON and the user should be blocked on saving or at least receive an alert saying that without selecting a category there won't be any constraints on the category, as if 'enable_category' is OFF, as implemented by your PRs.
I think that issue #17708 is still needed.

avatar infograf768
infograf768 - comment - 25 Aug 2017

I think that issue #17708 is still needed.

Agree, but can be done separately. (requiredon is not a simple task to implement)

avatar LivioCavallo
LivioCavallo - comment - 25 Aug 2017

@infograf768 : I agree. This PR fixes problems. Thanks all.
A better Long term user experience will be eventually provided by #17708

avatar LivioCavallo
LivioCavallo - comment - 27 Aug 2017

Why is AppVeyor failing?

avatar LivioCavallo
LivioCavallo - comment - 29 Aug 2017

I tested it in Jommla! 3.7.4, 3.7.5 and 3.8 beta. This patch works as expected.
Did someone else test it?

avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Apr 2019
Category Front End com_content Administration Language & Strings Administration com_content Front End
avatar joomla-cms-bot joomla-cms-bot - change - 8 Aug 2019
Category Front End com_content Administration Administration Language & Strings Front End com_content
avatar infograf768
infograf768 - comment - 8 Aug 2019

I have tested this item successfully on ad148a7


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

avatar infograf768 infograf768 - test_item - 8 Aug 2019 - Tested successfully
avatar infograf768 infograf768 - change - 8 Aug 2019
Title
Security fix: user with authorization to create in at least a category can access editor view in menuitems for other categories
UI fix: user with authorization to create in at least a category can access editor view in menuitems for other categories
avatar infograf768 infograf768 - edited - 8 Aug 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 8 Aug 2019

@alikon can you please retest?

avatar alikon
alikon - comment - 8 Aug 2019

I have tested this item successfully on ad148a7


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

avatar alikon alikon - test_item - 8 Aug 2019 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 8 Aug 2019
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 8 Aug 2019

Status "Ready To Commit".

avatar infograf768 infograf768 - change - 9 Aug 2019
Labels Added: ?
avatar richard67
richard67 - comment - 30 Dec 2019

@HLeithner What happens with this PR?

avatar HLeithner
HLeithner - comment - 22 Jan 2020

Something take longer then other, thanks for this PR

avatar HLeithner HLeithner - close - 22 Jan 2020
avatar HLeithner HLeithner - merge - 22 Jan 2020
avatar HLeithner HLeithner - change - 22 Jan 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-01-22 21:45:35
Closed_By HLeithner

Add a Comment

Login with GitHub to post a comment