Fix the 500 response of /oauth/revoke for a valid token with a space
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- php
- Domain
- api, authentication
Research direction
Start with TokenLookupService::resolveToken() in modules/simple_oauth_server_metadata/src/Service/TokenLookupService.php and compare the value sent in the Authorization header with the value passed to the JWT parser. Check the exception handling in modules/simple_oauth_server_metadata/src/Controller/TokenRevocationController.php and look for existing revocation tests. Done when valid tokens with surrounding spaces return 200 and are either revoked or treated as unknown, without changing the response for invalid tokens.
Written by the indexing model from the issue text.
Description
Problem
POST /oauth/revoke returns 500 with server_error when the token parameter is a valid access token with one space before or after it. The token stays active. An invalid value with a space gets 200.
TokenLookupService::resolveToken() puts the value in an Authorization header and gives it to the resource server. The resource server reads the value without the space and accepts it. The method then gives the original value to the JWT parser, and the parser throws an exception (modules/simple_oauth_server_metadata/src/Service/TokenLookupService.php, lines 72 to 83). TokenRevocationController changes each exception into a 500 (modules/simple_oauth_server_metadata/src/Controller/TokenRevocationController.php, lines 161 to 171).
Expected Behavior
The endpoint returns 200 for each token value. RFC 7009 section 2.2 gives that status also for an invalid token. The endpoint revokes a valid token with a space, or it treats the value as unknown.
Steps to Reproduce
- Get an access token for a confidential client.
- Send
POST /oauth/revokewith the client credentials. Set thetokenparameter to the access token and one trailing space. - The response is 500 with
{"error": "server_error"}. Introspection still reports the access token as active.
Additional Context
/oauth/introspect returns active: false for the value with the space. Found on v2.1.1.
- Dominant language
- JavaScript
- Stars
- 6
- Forks
- 9
- Avg merge
- 9h 41m
- Merged PRs (30d)
- 15
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from e0ipso/simple_oauth_21
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
e0ipso/simple_oauth_21#63 ·
Maintainers usually reply within 1 day
-
category::bug code priority::normal
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
e0ipso/simple_oauth_21#58 ·
Maintainers usually reply within 1 day
-
category::bug code priority::normal
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
e0ipso/simple_oauth_21#55 ·
Maintainers usually reply within 1 day
-
category::bug code priority::minor
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
e0ipso/simple_oauth_21#53 ·
Maintainers usually reply within 1 day
-
category::bug code priority::minor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
e0ipso/simple_oauth_21#52 ·
Maintainers usually reply within 1 day
All issues in e0ipso/simple_oauth_21
Similar issues
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
Jason-Vaughan/TangleClaw#3270 ·
Maintainers usually reply within 1 day
-
docs
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
open-telemetry/opentelemetry.io#12846 ·
Maintainers usually reply within 1 day
-
Beginner Enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
JSPrismarine/JSPrismarine#3740 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 88/100
xdelmo/Portfolio-minimal#637 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
angrymrt/wiskunde-fit#242 ·
Maintainers usually reply within 1 day