From 0e33f21206bd7b54cd1219dbc2f22cc5346d8fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Mon, 23 Nov 2026 21:58:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(cd):=20=E6=A0=A1=E9=AA=8C=E4=B8=BB=E7=AB=99?= =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95=E4=BB=A3=E7=90=86=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=90=8E=E7=9A=84=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/production_cd.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/production_cd.py b/scripts/production_cd.py index eefc997..afbba41 100644 --- a/scripts/production_cd.py +++ b/scripts/production_cd.py @@ -667,7 +667,15 @@ class LiveHost: def read_asset(path): return run(['docker', 'exec', name, 'cat', '/usr/share/nginx/html' + path], 'read running web asset') - require(origin_index == read_asset('/index.html'), 'served index differs from running web image') + image_index = read_asset('/index.html') + if origin_index != image_index: + # The main site's SSO proxy strips the crossorigin attribute on same-origin assets. + config = run(['docker', 'exec', name, 'cat', '/etc/nginx/conf.d/default.conf'], + 'read active web configuration') + expected = re.sub(rb'(<(?:script|link)\b[^<>]*?) crossorigin(?= (?:src|href)="/assets/)', + rb'\1 ', image_index) + require(b"sub_filter 'crossorigin' '';" in config and origin_index == expected, + 'served index differs from running web image') for path, served_digest in assets.items(): require(hashlib.sha256(read_asset(path)).hexdigest() == served_digest, 'served asset differs from running web image') return assets -- 2.52.0