Skip to content

feat: add authorization validation - #30

Merged
uniqueg merged 31 commits into
devfrom
security
May 26, 2020
Merged

uniqueg merged 31 commits into
devfrom
security

Conversation

@kushagra189

@kushagra189 kushagra189 commented May 16, 2020 •

Copy link
Copy Markdown
Contributor
  • The original code was taken from cwl-WES
  • JWT tokens can be validated by either the OICD-compliant IdP's /userinfo endpoint and/or the public key
  • To generalize the usability of the token validation decorator, app configuration parameters called in the original code are now passed through the decorator from the calling context
  • A security vulnerability in the original code was fixed that would authorize any token validated via the public key validation method if the IdP would return an empty JWK set via its dedicated endpoint

Closes #29

@uniqueg uniqueg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Apart from missing unit tests, also the requirement for get_conf() and get_conf_type() should be lifted (see comment for details)

Comment thread foca/security/auth.py Resolved
@kushagra189 kushagra189 self-assigned this May 19, 2020
@kushagra189
kushagra189 requested a review from uniqueg May 19, 2020 14:52
@uniqueg

uniqueg commented May 20, 2020

Copy link
Copy Markdown
Member

This is coming along great @kushagra189 - thanks a lot! Now let's get the code coverage up to 100% ;-)

@uniqueg uniqueg changed the title Decorator handler added add JWT validation decorator May 20, 2020
Comment thread tests/security/test_auth.py Outdated


"""
Test for checking authorization requirement

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add those as docstrings to the function headers as described in PEP257. For example:

def my_func():
    """Docstring describing what my_func() does"""
    <function body>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have done this and also fixed a typo (changed useinfo to userinfo) in the latest commit

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.

I was about to commit the same :p

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry :-S

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@kushagra189
kushagra189 requested a review from uniqueg May 21, 2020 17:45
@uniqueg

uniqueg commented May 24, 2020

Copy link
Copy Markdown
Member

Wow, nice, 90+% 💪

@uniqueg uniqueg changed the title add JWT validation decorator feat: add authorization validation May 26, 2020
@uniqueg
uniqueg merged commit 4c9e0c1 into dev May 26, 2020
@uniqueg
uniqueg deleted the security branch May 26, 2020 01:24
uniqueg added a commit that referenced this pull request Jul 3, 2020
- Add a decorator that validates JWT tokens via either the OICD-compliant IdP's /userinfo endpoint and/or the public key

Co-authored-by: Alex Kanitz <[email protected]>
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.

Add decorator for protecting endpoints

3 participants