Don't allow access to the API Tokens resource if using an API token.

Review Request #6257 — Created Aug. 23, 2014 and submitted

Information

Review Board
master
d2e02aa...

Reviewers

This change blocks off access to the user's API Tokens resource if the
user is logging in through an API token. They instead have to log in
using their main username and password.

This prevents a vulnerability where a client using a restricted API
token that still had read access to the API Tokens resource would be
able to look up a more permissive token and use that.

There's a new 'api_token_access_allowed' flag on resources that can be
turned off to prevent token-based access.

Some work had to be done to the basic tests mixins to only perform the
API tokens test if the unit tests don't turn it off.

Unit tests pass.

I tested manually using curl with and without API tokens. I wasn't able
to access the API Tokens resource with any token.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/base.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/resources/api_token.py
        reviewboard/webapi/tests/test_api_token.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/base.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/resources/api_token.py
        reviewboard/webapi/tests/test_api_token.py
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (28a7ede)
Loading...