Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access controls: provide more specific reason for request rejection #126

Closed
johakoch opened this issue Feb 25, 2021 · 2 comments · Fixed by #154
Closed

access controls: provide more specific reason for request rejection #126

johakoch opened this issue Feb 25, 2021 · 2 comments · Fixed by #154
Assignees

Comments

@johakoch
Copy link
Collaborator

Currently there are only two visible reasons for a request rejected by JWT access control:

  • "Authorization required" with status 401
  • "Authorization failed" with status 403

Internally, there are several reasons for the rejection of a request, leading to "Authorization failed" with status 403:

  • an Authorization header is included, but its value lacks "bearer" (case-insensitively) (accesscontrol.ErrorBearerRequired)
  • the JWT is malformed (jwt.MalformedTokenError), e.g.
    • it does not consist of three parts separated by '.'
    • the JWT header is malformed
    • the JWT body is malformed
  • the token signature is invalid (jwt.InvalidSignatureError)
  • the token issuer (iss claim) has an unexpected value (jwt.InvalidIssuerError)
  • the expected token audience is not found in the aud claim (if present) (jwt.InvalidAudienceError)
  • the token lacks a required claim (jwt.InvalidClaimsError)
  • the token lacks a required claim, for which a specific value is expected
  • the token has a required claim, but its value is unexpected

It would be handy to have the more specific reason in the error response.

@johakoch johakoch self-assigned this Feb 26, 2021
@johakoch johakoch changed the title JWT validation: provide more specific reason for request rejection access controls: provide more specific reason for request rejection Mar 17, 2021
@johakoch
Copy link
Collaborator Author

Same for other access controls (like saml2_acs)

@filex
Copy link
Contributor

filex commented Mar 17, 2021

It would be handy to have the more specific reason in the error response.

the specific reason should be included in the error field of the access log. we should probably not "leak" that information to the client.

@johakoch johakoch linked a pull request Mar 18, 2021 that will close this issue
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 a pull request may close this issue.

2 participants