Revocation rejects confidential clients that have no saved consumer secret
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- php
- Domain
- authentication
Research direction
The check to remove is in ClientAuthenticationService::validateClientCredentials(), where the secret_field isEmpty() early return sits before the call to ClientRepository::validateClient(). Read that method first, then delete the isEmpty() check and the $secret_field variable so the client repository decides. Done when a confidential consumer-plugin client with the right secret authenticates while a wrong secret is still rejected, and the existing tests for saved consumers still pass.
Written by the indexing model from the issue text.
Description
Problem
ClientAuthenticationService::validateClientCredentials() returns FALSE when the consumer's secret field is empty, before it calls ClientRepository::validateClient():
if (!empty($provided_secret)) {
// Get the stored secret hash.
if ($secret_field->isEmpty()) {
return FALSE;
}
return $this->clientRepository->validateClient(
$consumer->getClientId(),
$provided_secret,
NULL
);
}
That rejects confidential clients that a decorator of simple_oauth.repositories.client serves without a saved consumer. Simple OAuth Consumer Plugin defines consumers in code: its repository decorator returns an unsaved Consumer, and its validateClient() checks the secret from an environment variable, a setting, or a Key entity. The unsaved consumer's secret field is always empty, so the token revocation endpoint rejects those clients even with the right secret.
The check isn't needed. Simple OAuth's ClientRepository::validateClient() already returns FALSE for a consumer without a stored secret.
Proposed resolution
Remove the isEmpty() check and the $secret_field variable, and let the client repository decide:
$is_confidential = $client_entity->isConfidential();
- $secret_field = $consumer->get('secret');
// Public clients (not confidential) can authenticate with just client_id.
if (!$is_confidential && empty($provided_secret)) {
return TRUE;
}
// If a secret is provided, it must be validated regardless of client type.
if (!empty($provided_secret)) {
- // Get the stored secret hash.
- if ($secret_field->isEmpty()) {
- return FALSE;
- }
-
// Use the client repository's validateClient method which properly
I ran authenticateClient() with this change on 1.13.11, with Simple OAuth 6.1.5:
| Client | Secret | Result |
|---|---|---|
| Consumer plugin, confidential | Right | Authenticated |
| Consumer plugin, confidential | Wrong | Rejected |
| Saved confidential consumer with no stored secret | Any | Rejected |
| Saved confidential consumer | Right | Authenticated |
| Saved confidential consumer | Wrong | Rejected |
Without the change, the first row is rejected.
- 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
-
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 78/100
e0ipso/simple_oauth_21#54 ·
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