dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
855 stars 467 forks source link

Content API isn't respecting permissions #12536

Closed bryanboza closed 6 years ago

bryanboza commented 7 years ago

We have problems validating permissions in the content API when you try to get content via REST, this because an anonymous user can get private content.

Expected Behavior

We should validate if the requesting user have permissions to get the requested content

Current Behavior

An anonymous user is able to get content from any content type, without validate if have permissions or not

Steps to Reproduce (for bugs)

  1. Create a new content type
  2. Add some contents to this content type
  3. Edit the content type permissions, and set permissions just to admin per1
  4. Apply cascade changes
  5. Make sure every piece of content have the same permissions per2
  6. Try to get content from this content type via REST per3

Your Environment

Tested on master // Postgres // Postman

bryanboza commented 7 years ago

Tested after the last changes and we still having the same problem, but to reproduce you should add some pieces of content to the content type before change the permissions... Seems the problems can be with the reset all permissions process. To recreate:

FYI: After reindex we are unable to get these contents

jcastro-dotcms commented 7 years ago

PR core: https://github.com/dotCMS/core/pull/12685 PR ee : https://github.com/dotCMS/enterprise-2.x/pull/542

bryanboza commented 7 years ago

Ok, after test the last changes, now the original problem has been fixed, but now we are having another problem with permissions:

SC: https://screencast.com/t/BU2JpjveWR

wezell commented 7 years ago

@bryanboza actually, permissions are loaded lazily. This means that if you change permissions without first loading the content, it will get the new permissions. A bug would be:

  1. Load the content check the permissions
  2. Change the permissions on a subfolder and don't cascade them
  3. Check the permissions on the content again and see that they have not been changed.
  4. cascade the folder permissions, let it finish and then check the content permissions again - they should be changed.
bryanboza commented 7 years ago

Ok @wezell, actually your case works as expected, but if you try to reproduce my case on demo.dotcms.com, we have a totally different behavior. Steps:

However we have two roles, the default and the new one. SC: https://screencast.com/t/10RVNQko

jgambarios commented 7 years ago

Note to QA: After a meeting with Will we realize the issue reported in this https://github.com/dotCMS/core/issues/12536#issuecomment-333656959 is an expected behaviour.

bryanboza commented 7 years ago

Fixed...