eclipse-ee4j / eclipse-ee4j/jersey

RolesAllowed should throw NotAuthorizedException when no authorisation exists

Open
#3,337 4 comments 1 reaction 0 assignees View on GitHub
Component: security Priority: Major Type: Improvement
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

In org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature[line:139] it's throwing a javax.ws.rs.ForbiddenException however this set of my OCD alarm. I believe it should be a javax.ws.rs.NotAuthorizedException as by definition is does not have any authorisation. It even says it in the locale messages.

I believe this is related to #3090 which did recommend a javax.ws.rs.NotAuthorizedException but looks like it has been subsequently overwritten by #3180. There is a recent comment about this as the challenge is incorrect and not modifiable. Therefore this leads me to think we need this to be reverted and a way of setting the permissible challenges implemented.
#### Environment
ALL
#### Affected Versions
[2.22, 2.22.1, 2.22.2]

Contributor guide

Open the contributing guide

Research direction

Start at org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature line 139 and review the discussion in issues #3090 and #3180, including the comment about the incorrect challenge. Done means resolving the exception choice and providing a way to set permissible challenges, with behavior verified by the relevant existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authorization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.