A number of API and UI actions/URLs for viewing and managing organisations and locations are not limited to the orgs/locations assigned directly to the user, instead they are only restricted by permissions assigned to the user's roles.
* API index calls: GET /api/v2/organizations, GET /api/v2/locations
* API show/update/destroy calls
* UI edit/update/destroy calls
The UI index for orgs/locations and the UI org/location switcher appears to be the only place where the user's associated orgs/locations are taken into account.
Both UI and API controllers should be overriding methods for resource scopes to limit them further to the Organization.my_organizations/Location.my_locations scopes.
+Mitigation+: ensure all org/location related permissions assigned to a user are restricted to certain orgs/locations, these should still be taken into account.
Thanks to Ivan Necas for reporting this to foreman-security.
Created from redmine issue http://projects.theforeman.org/issues/15268
Upstream bug assigned to mhulan
Moving to POST since upstream bug http://projects.theforeman.org/issues/15268 has been closed
Eric, it seems that only Foreman part was cherry-picked but Katello needs a fix too, otherwise tests are broken. The revision is not associated from Katello repo for some reason, could you please CP https://github.com/Katello/katello/pull/6129/commits/494221ef7957cacc05bd2ad24b6a58060e5bd65a or let me know how should I proceed? Thank you.
Once the Katello unit tests ran, they failed and we discovered the test fix was needed and they were added. Looking at the timeline seems you noticed they earlier than we did we just didn't see the comment before we saw the test failures.
Verified in Satellite 6.2.1 Snap 1.1
After creating a new user "test" was created and assigned only to organization "test" and location "test". The user was successfully limited to viewing/editing orgs and locations in UI. The same is true for API.
"created_at": "2016-08-08 19:57:24 UTC",
"updated_at": "2016-08-08 19:57:24 UTC",
PUT /katello/api/organizations/1 (Default Org)
"message": "Resource organization not found by id '1'"
"created_at": "2016-08-08 19:58:16 UTC",
"updated_at": "2016-08-08 19:58:16 UTC",
PUT /api/locations/2 (Default)
"message": "Resource location not found by id '2'"
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.