复制的 Cesium 组件会直接执行 CDN JavaScript,未提供完整性校验
原文依据:3 处组件在浏览器中动态创建 script 标签并从 cesium.com 加载 Cesium.js,然后直接执行;可见代码没有子资源完整性哈希或本地供应链锁定。版本号固定只能稳定路径,不能验证返回内容。
若 CDN、传输终点或上游发布内容被破坏,返回的脚本将在渲染浏览器上下文中执行,并能访问页面中的数据及可用凭据。
当用户按 Cesium 技法复制或导入该组件并运行预览/渲染时,组件会从固定版本路径动态插入远程 CSS 和 JavaScript;可见代码没有 `integrity` 校验。固定 URL 版本降低意外升级概率,但不能验证服务器返回的字节,远端被篡改或供应链受损时,代码会在渲染浏览器权限内执行。用户可要求本地打包并锁定 Cesium,或提供经过校验的资源哈希和严格网络限制。
const GOOGLE_MAPS_API_KEY = process.env.REMOTION_GOOGLE_MAPS_API_KEY;const CESIUM_VER = '1.143';const CDN = `https://cesium.com/downloads/cesiumjs/releases/${CESIUM_VER}/Build/Cesium/`;const R = 6371;查看另外 2 个位置
const loadCesium = () => new Promise<any>((resolve, reject) => { if ((window as any).Cesium) return resolve((window as any).Cesium); (window as any).CESIUM_BASE_URL = CDN; const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = `${CDN}Widgets/widgets.css`; document.head.appendChild(css); const script = document.createElement('script'); script.src = `${CDN}Cesium.js`; script.onload = () => resolve((window as any).Cesium); script.onerror = () => reject(new Error(`Failed to load CesiumJS ${CESIUM_VER}`)); document.head.appendChild(script); });1. Copy `assets/CesiumFlythrough.tsx`, a path JSON and `assets/example-Root.tsx` into the Remotion project, or import the component directly.2. Supply the camera route as `[longitude, latitude][]`. Use only meaningful control points; do not hand-author dozens of tiny corrections.