web-svc-logout: merge logout domains into CSP connect-src and refactor task flow

• Add tasks/01_core.yml to set applications[application_id].server.csp.whitelist['connect-src'] = LOGOUT_CONNECT_SRC_NEW.

• Switch tasks/main.yml to include 01_core.yml (run-once guard preserved).

• Update templates/env.j2 to emit LOGOUT_DOMAINS as a comma-separated list.

• Rework vars/main.yml: compute LOGOUT_DOMAINS, derive LOGOUT_ORIGINS with WEB_PROTOCOL, read connect-src via the get_app_conf filter, and merge/dedupe (unique).

Rationale: ensure CSP allows cross-domain logout requests for all configured services.

Conversation: https://chatgpt.com/share/68b5b07d-b208-800f-b6b2-f26934607c8a
This commit is contained in:
2025-09-01 16:41:33 +02:00
parent b834f0c95c
commit 4ae3cee36c
4 changed files with 37 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ container_port: 8000
# The following line leads to that services which arent listed directly in the inventory,
# but are called over other roles, aren't listed here
# @todo implement the calling of also dependency domains (propably the easiest to write a script which adds all dependencies to group_names)
logout_domains: >-
{{
(applications | logout_domains(group_names)) | unique | join(',')
}}
LOGOUT_DOMAINS: "{{ (applications | logout_domains(group_names)) | unique }}"
LOGOUT_ORIGINS: "{{ LOGOUT_DOMAINS | map('regex_replace', '^(.*)$', WEB_PROTOCOL ~ '://\\1') | list }}"
LOGOUT_CONNECT_SRC_OLD: "{{ applications | get_app_conf(application_id,'server.csp.whitelist.connect-src') }}"
LOGOUT_CONNECT_SRC_NEW: "{{ (LOGOUT_CONNECT_SRC_OLD + LOGOUT_ORIGINS) | unique }}"