DELETE project API is failing in forbidden(403) error message

Bug #1705081 reported by prashkre
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
High
Lance Bragstad

Bug Description

With ldap as identity backend driver, when some project is deleted using DELETE /v3/projects/{project_id} API, it is failing in
RESP BODY: {"error": {"message": "You are not authorized to perform the requested action.", "code": 403, "title": "Forbidden"}}

In the delete project flow, with change-set[0] a notification action is configured at [1] to clear default project information on all users by invoking respective identity backend driver at [2] in method unset_default_project_id() but for ldap driver at [3] it is configured to throw forbidden error. Since ldap doesn't maintain project information on users, unset_default_project_id() method at [3] doesn't require any specific functionality to clean up project information on users.

[0] https://github.com/openstack/keystone/commit/51d5597df729158d15b71e2ba80ab103df5d55f8
[1] https://github.com/openstack/keystone/blob/master/keystone/identity/core.py#L492
[2] https://github.com/openstack/keystone/blob/master/keystone/identity/core.py#L533
[3] https://github.com/openstack/keystone/blob/master/keystone/identity/backends/ldap/core.py#L92

prashkre (prashkre)
Changed in keystone:
assignee: nobody → prashkre (prashkre)
Revision history for this message
Lance Bragstad (lbragstad) wrote :

One possible solution would be to except the Forbidden [0], log a message, and continue on. I'm not sure how much sense it makes to do anything in that case since we don't support writable LDAP.

Keystone must have been configured for ldap as the identity backend and sql as the resource backend, right?

[0] https://github.com/openstack/keystone/blob/025e844fc485c23be1de033473f3cadd7486b642/keystone/identity/backends/ldap/core.py#L157

Changed in keystone:
status: New → Triaged
importance: Undecided → High
milestone: none → pike-3
Revision history for this message
Lance Bragstad (lbragstad) wrote :

This is very similar to another bug we had opened recently [0]. We might be able to close this bug as a duplicate of 1705072 if we take steps similar to what I outlined in comment #2 [1].

[0] https://bugs.launchpad.net/keystone/+bug/1705072
[1] https://bugs.launchpad.net/keystone/+bug/1705072/comments/2

Revision history for this message
Matthew Edmonds (edmondsw) wrote :

I think the solution here is just to "pass" in the ldap driver impementation instead of calling _disallow_write. This is specific to the LDAP driver and not really tied to the other bug.

Revision history for this message
Lance Bragstad (lbragstad) wrote :

I would assume the callback to understand the drivers it needs to call, somehow. In the event it detects an LDAP driver it can continue to the next driver, knowing it will fail.

We use a similar pattern with the token providers and persistence. Each token provider implements a persistence property that return True or False depending on if the token needs to be written somewhere. This makes it so the manager understand if it needs to pull the token reference before handing it to the token provider. We could use a similar pattern here. This would also leave things open enough for people writing their own backends (all they have to do is implement the property and the callback does the right thing).

Changed in keystone:
milestone: pike-3 → pike-rc1
Revision history for this message
Lance Bragstad (lbragstad) wrote :

Based on some discussion in IRC - I've opened this up as a ML thread [0] to get some more feedback from the API-WG. The proper solution to this fix will result in a 403 -> 204 status code change.

[0] http://lists.openstack.org/pipermail/openstack-dev/2017-August/120678.html

Revision history for this message
Lance Bragstad (lbragstad) wrote :
prashkre (prashkre)
Changed in keystone:
assignee: prashkre (prashkre) → nobody
Revision history for this message
Matthew Edmonds (edmondsw) wrote :

this is due to a bug introduced in Pike, so NOT fixing this would be breaking the API guidelines (changing the response from 2xx to 403). Need to fix this before Pike goes out.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/491546

Changed in keystone:
assignee: nobody → Lance Bragstad (lbragstad)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/491546
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=b068d71b59c092820b1e78dd87a3fb00b40802eb
Submitter: Jenkins
Branch: master

commit b068d71b59c092820b1e78dd87a3fb00b40802eb
Author: Lance Bragstad <email address hidden>
Date: Mon Aug 7 20:29:08 2017 +0000

    Except forbidden when clearing default project IDs

    The identity backend registers a callback that listens for when a
    project is deleted. When it receives a notification, it uses the
    project ID send in the notification and removes all references to it
    from the identity backend, where users might have it referenced in
    their `default_project_id` attribute. The original fix for this did
    not account for LDAP backends being read-only. This caused an issue
    where DELETE /v3/projects/{project_id} actually caused an HTTP 403
    Forbidden exception because the LDAP backend wasn't writeable,
    despite that project actually being deleted.

    This change makes the identity API manager handle the exception
    and tests it specifically for LDAP, or read-only, backends.

    Change-Id: I16f4fcb289dad2fe752f3188476329c95cf777c9
    Closes-Bug: 1705081

Changed in keystone:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/keystone 12.0.0.0rc1

This issue was fixed in the openstack/keystone 12.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.