Skip to content

JWT token auth for signing API (bug 1210889)#808

Merged
kumar303 merged 1 commit intomozilla:masterfrom
kumar303:jwt-auth
Oct 9, 2015
Merged

JWT token auth for signing API (bug 1210889)#808
kumar303 merged 1 commit intomozilla:masterfrom
kumar303:jwt-auth

Conversation

@kumar303
Copy link
Copy Markdown
Contributor

@kumar303 kumar303 commented Oct 8, 2015

This sets the foundation for JWT token auth. The rationale for using header tokens is in the bug (and linked discussion).

TODO:

  • add a bunch of docstrings :)

@kumar303 kumar303 assigned mstriemer and magopian and unassigned mstriemer and magopian Oct 8, 2015
Comment thread settings.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this appear in both settings.py and lib/settings_base.py?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings.py, although the name is misleading, has a comment at the top saying that it's only for development settings. The lib/settings_base.py is the default for all configurations. By default there are no encryption keys so it will fail hard. I need to fix up this patch to configure some keys on each production setting file and also file an ops bug to generate the keys once this lands.

@andymckay
Copy link
Copy Markdown

Stupid question to check for due diligence etc: is this vulnerable to algo: none as per bug 1145024?

@kumar303
Copy link
Copy Markdown
Contributor Author

kumar303 commented Oct 9, 2015

is this vulnerable to algo: none

Not a stupid question at all! I did verify this. We only allow one algorithm here which is configurable and set right now to HMAC-SHA-256. When verifying the signature, PyJWT will only permit this algorithm.

Comment thread apps/api/jwt_auth/views.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 16 of apps/api/jwt_auth/handlers.py seems very similar but that uses APIKey.objects.get(key=key, type=SYMMETRIC_JWT_TYPE). Why the difference? Should there be a helper on APIKeyManager like APIKey.objects.get_key(key)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes. I think a manager function would be really helpful here. The type= filter was my attempt at making APIKey re-usable for other (future) types of keys so I should definitely be doing APIKey.get_jwt_key() or something.

@mstriemer
Copy link
Copy Markdown
Contributor

r+wc

kumar303 added a commit that referenced this pull request Oct 9, 2015
JWT token auth for signing API (bug 1210889)
@kumar303 kumar303 merged commit aa68481 into mozilla:master Oct 9, 2015
@kumar303 kumar303 deleted the jwt-auth branch October 9, 2015 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants