eclipse-ee4j / eclipse-ee4j/jersey

Clarify ambiguous HTTP return code

Open
#5,062 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

https://github.com/eclipse-ee4j/jersey/blob/7b6d2f84391f24310baae7d8e55e644703642826/core-server/src/main/java/org/glassfish/jersey/server/filter/RolesAllowedDynamicFeature.java#L55-L56

The specification of the expected HTTP status code is ambiguous. `403 (Not Authenticated)` does not exist in [RFC 7235](https://www.rfc-editor.org/rfc/rfc7235). It should be either `403 (Forbidden)` or `401 (Unauthorized)`.

According to [RFC 7235](https://www.rfc-editor.org/rfc/rfc7235) ...
> A server that receives valid credentials that are not adequate to
gain access ought to respond with the 403 (Forbidden) status code

> The 401 (Unauthorized) status code indicates that the request has not
been applied because it lacks valid authentication credentials for
the target resource.

... 401 (Unauthorized) might be the appropriate/intended return code.

Contributor guide

Open the contributing guide

Research direction

Read RolesAllowedDynamicFeature.java at the linked lines, then compare the behavior with the cited RFC 7235 definitions for 401 and 403. Determine which authentication state the role check represents; done means the chosen status code and its specification-facing wording are no longer ambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authorization, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.