#28588: has_perm with superusers hides non-existent permissions
-----------------------------------------+------------------------
               Reporter:  Paul Hallett   |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  1.11
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 the {{{has_perm}}} method on the User model hides non-existent permissions
 by always returning True is the user is a superuser:

 {{{
 # Legit permission
 >>> super_user.has_perm('auth.can_add_user')
 True
 # Totally fake permission
 >>> super_user.has_perm('rubbishrubbishrubbish')
 True
 }}}

 Combined with sloppy testing (for example - most devs are superusers) this
 can lead to poor assumptions about the integrity of the code.

 I'd like to suggest that the {{{has_perm}}} attempts a look up for the
 Permission before resolving is the user is a super user or not.


 This has already been mentioned as one point in a long list in this
 ticket: [https://code.djangoproject.com/ticket/26547].

 I can't see what the resolution of the ticket was as it was just closed
 with a reason.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28588>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.63cfc17c9396778c919c050a4650a38b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to