Added sandboxing to AuthBackend

Review Request #5736 — Created April 24, 2014 and discarded

Information

Review Board
master

Reviewers

Added sandboxing to AuthBackend
Writing unit tests for the sandboxing for get_queryset and search_queryset

Unit testing for sandboxing get_queryset and search_queryset for AuthBackend

Description From Last Updated

This should be pulled out into a separate change.

daviddavid

You could use a lambda expression here, rather than defining a new method: self.spy_on(get_enabled_auth_backends, call_fake=lambda: [AuthTestQueryUsersBackend()])

daviddavid

These should also use lambdas.

daviddavid

local variable 'hook' is assigned to but never used

reviewbotreviewbot

Col: 1 W391 blank line at end of file

reviewbotreviewbot

local variable 'hook' is assigned to but never used

reviewbotreviewbot
david
  1. The registration code itself isn't something that I think needs to be sandboxed, since it doesn't run any third-party code. Instead, we want to sandox calls into the auth backends. You can search for get_enabled_auth_backends in the code to find where we iterate over auth backends and call methods on them.

  2. 
      
ED
david
  1. This is much better. I'm looking forward to seeing the full change including unit tests.

  2. 
      
ED
ED
david
  1. What's left to get this out of WIP?

  2. 
      
ED
ED
ED
david
  1. 
      
  2. reviewboard/extensions/templatetags/rb_extensions.py (Diff revision 5)
     
     
     
     
     
    Show all issues

    This should be pulled out into a separate change.

    1. It was, but I think when I merged with master it messed this part up.

  3. reviewboard/extensions/tests.py (Diff revision 5)
     
     
    Show all issues

    You could use a lambda expression here, rather than defining a new method:

    self.spy_on(get_enabled_auth_backends,
                call_fake=lambda: [AuthTestQueryUsersBackend()])
    
  4. reviewboard/extensions/tests.py (Diff revision 5)
     
     
     
    Show all issues

    These should also use lambdas.

  5. 
      
ED
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/extensions/templatetags/rb_extensions.py
        reviewboard/webapi/resources/user.py
        reviewboard/extensions/tests.py
      Ignored Files:
    
    
  2. reviewboard/extensions/tests.py (Diff revision 6)
     
     
    Show all issues
    Col: 1
     W391 blank line at end of file
    
  3. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/extensions/templatetags/rb_extensions.py
        reviewboard/webapi/resources/user.py
        reviewboard/extensions/tests.py
      Ignored Files:
    
    
  2. reviewboard/extensions/tests.py (Diff revision 6)
     
     
    Show all issues
     local variable 'hook' is assigned to but never used
    
  3. 
      
ED
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/extensions/templatetags/rb_extensions.py
        reviewboard/webapi/resources/user.py
        reviewboard/extensions/tests.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/extensions/templatetags/rb_extensions.py
        reviewboard/webapi/resources/user.py
        reviewboard/extensions/tests.py
      Ignored Files:
    
    
  2. reviewboard/extensions/tests.py (Diff revision 7)
     
     
    Show all issues
     local variable 'hook' is assigned to but never used
    
  3. 
      
ED
Review request changed
Status:
Discarded