收口H5原生导航目标预校验

H5 原生 App 导航请求发送前拒绝外域和危险协议目标

H5 HostBridge 测试覆盖不安全导航目标不触达原生壳

原生壳门禁反查 navigation.openNativePage 预校验
This commit is contained in:
2026-06-20 04:43:50 +08:00
parent 082e056b18
commit 0e807d1fe8
3 changed files with 112 additions and 1 deletions
+13
View File
@@ -1080,6 +1080,19 @@ function assertH5HostBridgePayloadBoundaries() {
'H5 HostBridge facade must normalize app.openExternalUrl payloads with the shared external URL boundary',
);
}
if (
!h5HostBridgeSource.includes('function normalizeNativeAppPageUrl(url: string)') ||
!h5HostBridgeSource.includes("trimmedUrl.startsWith('//')") ||
!h5HostBridgeSource.includes(
"nativePageUrl.origin !== HOST_BRIDGE_PUBLIC_WEB_ORIGIN",
) ||
!h5HostBridgeSource.includes('const normalizedUrl = normalizeNativeAppPageUrl(url);') ||
!h5HostBridgeSource.includes("{ url: normalizedUrl },")
) {
throw new Error(
'H5 HostBridge facade must reject unsafe native app navigation targets before sending navigation.openNativePage',
);
}
if (
!h5HostBridgeSource.includes(
'absolutizeHostSharePayloadUrls(params),',