From 815714592ce3d2dd8677d1e1279530c3cf4dce8f Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 31 Oct 2026 10:05:29 +0100 Subject: [PATCH] fix(web-svc-logout): keep each conductor's sweep on its own network CI run 41147980556 Nextcloud#0 failed both conductor design specs on a multi-network node. e0179a0893 handed every conductor the other network's conductor in LOGOUT_SIBLINGS. With that list set, universal-logout v1.5.0 hides #iframe-warning on the stand-alone page ("'#iframe-warning' matches nothing visible"), and v1.5.1 fetches the sibling after its sweep, which the conductor's per-network CSP blocks ("Connecting to 'https://logout.main.infinito.test/' violates ... connect-src 'self' *."). Requirement 037 limits each vhost's CSP to its own network, so the browser hand-off could never complete in either direction; its only effects were the two red specs. Drop the LOGOUT_SIBLINGS wiring and its README bullet, so the compose template and README match their state before e0179a0893. Each conductor still logs out of every domain of its own network; ending the sessions of the other network belongs on the server side, not in the browser. The test now asserts that no conductor on a single-network, tor-only or multi-network node is handed a conductor of another network. Co-Authored-By: Claude Opus 5.5 --- roles/web-svc-logout/README.md | 1 - roles/web-svc-logout/templates/compose.yml.j2 | 7 +------ .../templates/test_compose_siblings.py | 21 +++++++++---------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/roles/web-svc-logout/README.md b/roles/web-svc-logout/README.md index bfde22a647..697a04dee6 100644 --- a/roles/web-svc-logout/README.md +++ b/roles/web-svc-logout/README.md @@ -23,7 +23,6 @@ It solves the common challenge of logging a user out from all connected apps wit - Status page with live feedback on logout progress for each domain. - Built-in support for Docker Compose deployment and integration with the Infinito.Nexus ecosystem. - Includes security-conscious headers (CORS, CSP) for smooth cross-domain logout operations. -- **Network hand-off:** A node serving several networks runs one conductor per network, and each conductor receives the other conductors' origins in `LOGOUT_SIBLINGS`, so a finished sweep hands the browser on to the next network. A single-network node renders it empty, which disables the hand-off. ## Further Resources diff --git a/roles/web-svc-logout/templates/compose.yml.j2 b/roles/web-svc-logout/templates/compose.yml.j2 index 6037f26aa9..850bf35d61 100644 --- a/roles/web-svc-logout/templates/compose.yml.j2 +++ b/roles/web-svc-logout/templates/compose.yml.j2 @@ -5,18 +5,13 @@ {% for logout_domain in lookup('applications') | logout_domains(group_names, lookup('domains'), logout_instance.network) | unique | sort %} {% set _ = logout_urls.append(lookup('tls', logout_domain, 'url.origin')) %} {% endfor %} - {% set logout_siblings = [] %} - {% for logout_sibling in LOGOUT_INSTANCES if logout_sibling.network != logout_instance.network %} - {% set _ = logout_siblings.append(lookup('tls', lookup('domains')[application_id] | domain_strings | in_network(logout_sibling.network) | first, 'url.origin')) %} - {% endfor %} {{ service_name }}: {% include 'roles/sys-svc-container/templates/base.yml.j2' %} {{ lookup('container_image', application_id, 'logout') }} {{ lookup('compose_only', 'container_name', LOGOUT_CONTAINER | labelled(logout_instance.label, '-')) }} {{ lookup('container_ports', ['logout', 'http' | labelled(logout_instance.label, '_'), DOCKER_BIND_HOST]) | indent(4) }} - environment: # nocheck: compose-environment-from-env-file one conductor per served network and LOGOUT_DOMAINS and LOGOUT_SIBLINGS are derived per conductor rather than configured; a per-service env file is possible but costs a render loop and a second name binding for these computed lines + environment: # nocheck: compose-environment-from-env-file one conductor per served network and LOGOUT_DOMAINS is derived rather than configured; a per-service env file is possible but costs a render loop and a second name binding for this one computed line LOGOUT_DOMAINS: "{{ logout_urls | join(',') }}" - LOGOUT_SIBLINGS: "{{ logout_siblings | join(',') }}" {{ lookup('container_networks') | indent(4) }} {{ lookup('container_healthcheck', 'logout') | indent(4) }} diff --git a/tests/unit/python/roles/web-svc-logout/templates/test_compose_siblings.py b/tests/unit/python/roles/web-svc-logout/templates/test_compose_siblings.py index 00b066f743..ce1d32fb9f 100644 --- a/tests/unit/python/roles/web-svc-logout/templates/test_compose_siblings.py +++ b/tests/unit/python/roles/web-svc-logout/templates/test_compose_siblings.py @@ -120,30 +120,29 @@ def render(conductor: list[str], shop: list[str]) -> dict: return load_yaml_str(rendered)["services"] -def siblings(services: dict) -> dict[str, str]: - return { - name: service["environment"]["LOGOUT_SIBLINGS"] +def handing_off(services: dict) -> list[str]: + return sorted( + name for name, service in services.items() - } + if "LOGOUT_SIBLINGS" in service["environment"] + ) class TestSingleNetwork(unittest.TestCase): def test_a_clearnet_conductor_hands_off_nowhere(self) -> None: - self.assertEqual(siblings(render([CLEAR], [SHOP])), {"logout": ""}) + self.assertEqual(handing_off(render([CLEAR], [SHOP])), []) def test_a_tor_only_conductor_hands_off_nowhere(self) -> None: - self.assertEqual(siblings(render([ONION], [SHOP_ONION])), {"logout": ""}) + self.assertEqual(handing_off(render([ONION], [SHOP_ONION])), []) class TestClearnetAndTor(unittest.TestCase): def setUp(self) -> None: self.services = render([CLEAR, ONION], [SHOP, SHOP_ONION]) - def test_each_conductor_lists_exactly_the_other(self) -> None: - self.assertEqual( - siblings(self.services), - {"logout": f"http://{ONION}", "logout-onion": f"https://{CLEAR}"}, - ) + def test_no_conductor_is_sent_to_a_conductor_its_network_csp_blocks(self) -> None: + self.assertEqual(sorted(self.services), ["logout", "logout-onion"]) + self.assertEqual(handing_off(self.services), []) def test_each_conductor_still_sweeps_only_its_own_network(self) -> None: self.assertEqual(