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(