WEBAUTHN_ORIGIN with an internationalized domain never matches the browser Origin
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- authentication, backend
Research direction
Start with canonical_origin in server/orcaster_server/config.py and the existing tests in server/tests/test_config_webauthn_origin.py; check how the current URL parsing handles Unicode hosts, ports, and empty query or fragment markers. Add coverage for the listed acceptance criteria, then update the WEBAUTHN_ORIGIN description in the user manual and add an Unreleased changelog entry. Done means the Unicode and punycode origins match, invalid IDNA conversion reports WEBAUTHN_ORIGIN, and the existing ASCII, IP, and empty suffix behavior is covered.
Written by the indexing model from the issue text.
Description
Problem
canonical_origin normalizes WEBAUTHN_ORIGIN once at startup (server/orcaster_server/config.py:21-72, config.py:265-269). The result is compared for exact equality with the Origin header and with the origin in the WebAuthn client data (config.py:24-31).
For a host with non-ASCII characters, canonical_origin keeps the Unicode form and only lowercases it (config.py:60, via urlsplit(...).hostname). Browsers send the ASCII (punycode) form of the host in Origin. So a value such as https://bücher.example is accepted at startup but never matches. Passkey login fails and every cookie-authenticated write answers 403, which is exactly the silent failure that canonical_origin was written to prevent.
A smaller inconsistency: an empty query or fragment (https://host?, https://host#) is accepted and silently dropped, because urlsplit reports it as absent (config.py:54-57). https://host/? is rejected as a path. The behavior is harmless but not tested or documented.
Steps to reproduce
- Set
WEBAUTHN_ORIGIN=https://bücher.example(any internationalized domain that resolves to the server). - Start the server. It starts without error.
- Try a passkey login from a browser on that origin. The server rejects it, because the browser sends
Origin: https://xn--bcher-kva.example.
Proposed change
- In
canonical_origin, convert the host to its ASCII form with IDNA processing that matches browsers (Unicode UTS 46, non-transitional), then lowercase it. Hosts that are already ASCII and IP literals are unchanged. - If the conversion fails, fail startup with the existing
_bad_originmessage and the reason. - Keep accepting an empty
?or#suffix and drop it, as today. Pin this with a test and mention it in the docstring. - Update the
WEBAUTHN_ORIGINdescription in the user manual: an internationalized domain may be written in Unicode or punycode.
Compatibility
- Values that are ASCII today produce the same canonical origin as before. Existing deployments see no change.
- Values with a Unicode host start as before and now work for login.
- Values with an empty
?or#keep starting, with the same result. No value that starts today is refused after this change, except a Unicode host that cannot be converted, which never worked.
Acceptance criteria
-
canonical_origin("https://Bücher.Example", ...)returnshttps://xn--bcher-kva.example. - A punycode value and its Unicode spelling give the same canonical origin.
- ASCII hosts, IPv4 and IPv6 literals and ports give the same results as before (existing tests in
server/tests/test_config_webauthn_origin.pypass unchanged). - A host that cannot be converted fails startup with a message that names
WEBAUTHN_ORIGIN. - Tests pin that
https://host?andhttps://host#givehttps://host. - Existing deployments keep working without config changes.
- CHANGELOG entry under Unreleased.
Open questions
WEBAUTHN_RP_ID(config.py:99) is used as given. The relying party ID of an internationalized domain must also be in ASCII form. Should it get the same conversion in this issue? Converting only when the value is not ASCII keeps existing deployments working.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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 AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
daniel-ospina/tortoise#15308 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
difficulty:easy prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NatronGitHub/Natron#2405 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Jstar269/nakagawa-recomp#3746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day