NotFound exception is being thrown instead of PolicyNotAuthorized

Bug #1367795 reported by Thiago Paiva Brito
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Opinion
Undecided
Unassigned

Bug Description

Testing a new use case for a policy approach, I was contantly receiving a NotFound response on trying to access a volume. I could see the volume on horizon's inteface but cannot access it through python-cinderclient. Digging into cinder code I found that I could not access it due to policy restrictions, but the exception being thrown was NotFound instead of the far more informative PolicyNotAuthorized exception. Looking why is that I found this piece of code:

cinder/cinder/volume/api.py line 308:

        try:
            check_policy(old_ctxt, 'get', volume)
        except exception.PolicyNotAuthorized:
            # raise VolumeNotFound instead to make sure Cinder behaves
            # as it used to
            raise exception.VolumeNotFound(volume_id=volume_id)
        return volume

I believe it's an grotesque error to throw an exception that points into a direction that isn't the cause of the failure just because it was what cinder did in the past. Debuggers got crazy searching for an error when what's indeed happening is a completely different thing.

Changed in cinder:
assignee: nobody → Thiago Paiva Brito (thiagop)
Revision history for this message
Duncan Thomas (duncan-thomas) wrote :

This is a) an established API b) A security feature that prevents probing for volume IDs. Probing was much more of a problem when we used integer IDs ratehr than UUIDs, but still, by design.

Changed in cinder:
status: New → Opinion
Revision history for this message
Thiago Paiva Brito (outbrito) wrote :

The PolicyNotAuthorized exception's message says "Policy doesn't allow %(action)s to be performed". How does this message creates evidence that a volume truly exists?

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote : Bug Assignee Expired

Unassigning due to no activity for > 6 months.

Changed in cinder:
assignee: Thiago Paiva Brito (thiagop) → nobody
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.