Skip to content

oauth: fix WebFinger subject check for internationalized domain names - #1281

Merged
TheOneRing merged 1 commit into
opencloud-eu:mainfrom
jnodev:work/oauth-idn-webfinger
Nov 25, 2026
Merged

TheOneRing merged 1 commit into
opencloud-eu:mainfrom
jnodev:work/oauth-idn-webfinger

Conversation

@jnodev

@jnodev jnodev commented Nov 23, 2026 •

Copy link
Copy Markdown

Fixes #1280

Logging in to a server on an internationalized domain name (e.g. cloud.bücher.de) fails with "Error while trying to log in to OAuth2-enabled server".

Cause: the client sends the WebFinger resource in Unicode form (QUrl::toString()) and string-compares the returned subject. The server returns it percent-encoded (https://cloud.b%C3%BCcher.de/), so the check fails.

Fix: send the resource as punycode (QUrl::EncodeUnicode) and compare it with Utility::urlEqual(). Token refresh uses the same code path and is fixed too.

Details

  • urlEqual() also ignores a trailing slash and normalizes path segments, so the subject check is slightly more lenient than before.
  • New test TestOAuth::testInternationalizedDomainName fails without the fix. OAuthTestCase gets a virtual serverUrl() for it; existing tests are unchanged.

AI usage

I used Claude Code (Claude Opus 5.5) to analyse the root cause and to draft the fix and the test. I reviewed the change, built it and tested it myself against a real IDN server.

@TheOneRing TheOneRing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@TheOneRing TheOneRing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QUrl returns IDN hosts in Unicode, while the server returns the
WebFinger subject percent-encoded, so the string comparison failed
and login to IDN servers was impossible. Send the resource as
punycode and compare with Utility::urlEqual() instead.

Assisted-by: Claude Code:claude-opus-5-5
@jnodev
jnodev force-pushed the work/oauth-idn-webfinger branch from 7578abf to 1333682 Compare November 24, 2026 22:25
@jnodev

jnodev commented Nov 24, 2026

Copy link
Copy Markdown
Author

Thanks for the pointer. I've updated the commit (replaced Co-Authored-By with an Assisted-by tag and shortened the message) and rewrote the PR description following the AI guideline.

@TheOneRing
TheOneRing merged commit 4e24c73 into opencloud-eu:main Nov 25, 2026
14 of 15 checks passed
@TheOneRing

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login fails on domains with umlauts / non-ASCII characters (IDN)

2 participants