Repository navigation
HTTP Basic: opt-in UTF-8 credentials (RFC 7617), read token68 challenges - #1616
Merged
Merged
Conversation
- New opt-in, disabled by default: with the system property org.restlet.engine.security.basic.utf8=true a Basic challenge advertises charset="UTF-8", a server decodes the credentials as UTF-8 (falling back to ISO-8859-1) and a client answering such a challenge encodes UTF-8. Issue #1455. - A WWW-Authenticate challenge made of a token68 ending with "=" (Negotiate) was dropped with the whole header. Issue #191. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
RFC 9110 section 11.2 makes auth-param names case-insensitive. "Realm=" was ignored (null realm) and "Charset=" was not seen by the client. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Another test of the suite can leave a Restlet engine without the Basic authenticator helper (seen on CI, depending on the test order): the new tests now register a complete engine first. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The aim
Fixes #1455. Fixes #191.
charset="UTF-8"only if set by hand, so UTF-8 logins and passwords cannot work (RFC 7617 section 2.1).WWW-Authenticate: Negotiate <base64>==, Basic realm="a": the=padding of a token68 (RFC 9110 section 11.2) made the reader throw, and the whole header was dropped.The solution
Opt-in, disabled by default (no behavior change): with the system property
org.restlet.engine.security.basic.utf8=true(HttpBasicHelper.UTF8_PROPERTY):ChallengeAuthenticatoradvertisescharset="UTF-8";ChallengeResponsebuilt from a challenge request copies itscharset, so the client encodes UTF-8.Bug fixes:
ChallengeRequestReaderreads a token68 ending with=.realmandcharsetparameters of a Basic challenge are matched case-insensitively (RFC 9110 section 11.2);Realm=used to give a null realm.3.0 makes the UTF-8 behavior the default. Credentials are read at header parse time, before the authenticator is known, hence a global switch.
Reproduction
ChallengeRequestReader("Negotiate YIIabc==, Basic realm=\"a\"").readValues()is empty before the fix. For Basic: start the JVM with-Dorg.restlet.engine.security.basic.utf8=trueand call with loginzoë/ passwordp€ss.Check-list
🤖 Generated with Claude Code