fix(cd): 校验主站单点登录代理处理后的首页
build / build (push) Successful in 1m51s

This commit is contained in:
姚章浩
2026-11-23 21:58:48 +08:00
parent 83bba09cde
commit 0e33f21206
+9 -1
View File
@@ -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