From 009a772ebd62c2165d4c16de378a88f667b037cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Wed, 7 Oct 2026 11:43:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AA=92=E4=BD=93=E9=AA=8C=E8=AF=81=20E2E=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AF=B9=E6=9C=8D=E5=8A=A1=E7=AB=AF=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E5=89=8D=E7=BC=80=E7=9A=84=E7=A1=AC=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 「公开投影只暴露服务端派生的媒体 objectKey」改为结构断言:非空去空白、含路径分隔符、不是客户端 part 文件名 - 不再断言 agc/project-snapshots/v1/game-distribution/media/ 这一内部布局常量 - 与服务端返回键的一致性仍由相邻的 owner/公开投影相等断言覆盖 --- scripts/check-game-distribution-media-e2e.mjs | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/scripts/check-game-distribution-media-e2e.mjs b/scripts/check-game-distribution-media-e2e.mjs index 545e1aa6c..7d1fbd0fa 100644 --- a/scripts/check-game-distribution-media-e2e.mjs +++ b/scripts/check-game-distribution-media-e2e.mjs @@ -637,18 +637,25 @@ async function main() { publishedGame.screenshots[0] === created.data.screenshots[0], JSON.stringify(publishedGame?.screenshots ?? []), ); + // 只证明 objectKey 是服务端派生的对象路径、不是客户端直传的文件名;刻意不断言服务端内部 + // 的具体 bucket/前缀布局,避免把存储路径写死进 E2E。 + const clientPartNames = new Set([ + cover.fileName, + shot1.fileName, + shot2.fileName, + ]); + const isServerDerivedMediaKey = (key) => + typeof key === 'string' && + key.length > 0 && + key.trim() === key && + key.includes('/') && + !/^(?:blob|https?):/iu.test(key) && + !clientPartNames.has(key); check( '公开投影只暴露服务端派生的媒体 objectKey', - typeof publishedGame?.coverObjectKey === 'string' && - publishedGame.coverObjectKey.startsWith( - 'agc/project-snapshots/v1/game-distribution/media/', - ) && + isServerDerivedMediaKey(publishedGame?.coverObjectKey) && Array.isArray(publishedGame?.screenshots) && - publishedGame.screenshots.every( - (key) => - typeof key === 'string' && - key.startsWith('agc/project-snapshots/v1/game-distribution/media/'), - ), + publishedGame.screenshots.every(isServerDerivedMediaKey), ); // 9. 匿名读授权:封面与截图都走新的游戏媒体读路由换签名地址