Fix legacy conversion dropping 'empty origins = allow all' when an auth host was set
The **.{rp-id} wildcard was only added when the resulting origins dict
was empty, so a legacy database with a dedicated auth host but no
configured origins ended up allowing only the auth host.
This commit is contained in:
@@ -941,6 +941,22 @@ class TestLegacyConversion:
|
||||
config = convert_legacy_database(src_file, tmp_path / "paskia.kantadb")
|
||||
assert config.domains["example.com"].origins == {"**.example.com": True}
|
||||
|
||||
def test_convert_auth_host_with_empty_origins_keeps_wildcard(self, tmp_path):
|
||||
"""A dedicated auth host with no configured origins still allowed
|
||||
the whole rp-id domain in the legacy format — the auth host must
|
||||
not become the only allowed origin."""
|
||||
src_file = tmp_path / "main.db"
|
||||
asyncio.run(
|
||||
_write_legacy(
|
||||
src_file,
|
||||
LegacyConfig(rp_id="example.com", auth_host="auth.example.com"),
|
||||
)
|
||||
)
|
||||
config = convert_legacy_database(src_file, tmp_path / "paskia.kantadb")
|
||||
origins = config.domains["example.com"].origins
|
||||
assert origins["**.example.com"] is True
|
||||
assert origins["auth.example.com"] == OriginEntry(auth_host=True)
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Transaction log censoring
|
||||
|
||||
Reference in New Issue
Block a user