diff --git a/.github/worker-deploy-ci/cloudflare.config.ts b/.github/worker-deploy-ci/cloudflare.config.ts new file mode 100644 index 0000000000..c91185cfee --- /dev/null +++ b/.github/worker-deploy-ci/cloudflare.config.ts @@ -0,0 +1,22 @@ +import { bindings, defineConfig } from "cf/config"; +import * as entrypoint from "../../pkgs/github-ci/worker/src/index.ts" with { type: "cf-worker" }; + +export default defineConfig({ + worker: { + name: "github-ci", + compatibilityDate: "2025-09-15", + workersDev: true, + entrypoint, + env: { + TURSO_PLATFORM_URL: bindings.text("https://fleet-platform-dezren39.aws-us-east-1.turso.io"), + TURSO_QUEUE_URL: bindings.text("https://fleet-queue-dezren39.aws-us-east-1.turso.io"), + EVENTS_BROKER_URL: bindings.text("https://queue-broker.security.cab"), + GITHUB_WEBHOOK_SECRET: bindings.secret(), + TURSO_PLATFORM_TOKEN: bindings.secret(), + TURSO_QUEUE_TOKEN: bindings.secret(), + EVENTS_BROKER_TOKEN: bindings.secret(), + EVENTS_BROKER_ACCESS_CLIENT_ID: bindings.secret(), + EVENTS_BROKER_ACCESS_CLIENT_SECRET: bindings.secret(), + }, + }, +}); diff --git a/.github/worker-deploy-ci/package-lock.json b/.github/worker-deploy-ci/package-lock.json new file mode 100644 index 0000000000..79f2d648d9 --- /dev/null +++ b/.github/worker-deploy-ci/package-lock.json @@ -0,0 +1,2303 @@ +{ + "name": "github-ci-worker-deployment-toolchain", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "github-ci-worker-deployment-toolchain", + "version": "0.1.0", + "devDependencies": { + "cf": "1.0.0-rc.1", + "wrangler": "4.166.0" + }, + "engines": { + "node": "24.22.0" + } + }, + "node_modules/@cloudflare/build-output-utils": { + "version": "1.0.0-rc.1", + "resolved": "https://registry.npmjs.org/@cloudflare/build-output-utils/-/build-output-utils-1.0.0-rc.1.tgz", + "integrity": "sha512-IrzZL1UEdVMZPRarrKu2VpnL3MIeNVhCItTebB88SwQ1YJ4mLAe1kQtXmIH7MpdgDYnxAsTZXMtuw9q5jRWCcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cloudflare/config": "1.0.0-rc.1" + } + }, + "node_modules/@cloudflare/config": { + "version": "1.0.0-rc.1", + "resolved": "https://registry.npmjs.org/@cloudflare/config/-/config-1.0.0-rc.1.tgz", + "integrity": "sha512-NQgB+fQbk8IU0iJ6/G9LCSQjJ7JuyRn5CALrPKnQ8vxqayOJlX+av9adhLCMYBeC80ocncW1Gy7quv00uLV3LQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "zod": "4.6.6" + } + }, + "node_modules/@cloudflare/kv-asset-handler": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.5.1.tgz", + "integrity": "sha512-48OysfSW3MkQY1XjkhkpPkgrEkOvgfoyHzA2eyX5wpzFpijC02uWigv3hkNdJdT3C7ybW/U17yYHXeR68pLeww==", + "dev": true, + "license": "MIT OR Apache-2.0", + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/@cloudflare/runtime-types": { + "version": "0.1.30", + "resolved": "https://registry.npmjs.org/@cloudflare/runtime-types/-/runtime-types-0.1.30.tgz", + "integrity": "sha512-p68T70lDZT7Vyv5c2SDzB0uqVRVCtj/3WMgXVQESnWVyTybcCwXRM9Ekmh2rQ+aPGhtIWiACvd8pX2yGA9Z5mw==", + "dev": true, + "license": "MIT", + "dependencies": { + "miniflare": "5.20261117.0-beta", + "workerd": "1.20261117.1" + } + }, + "node_modules/@cloudflare/unenv-preset": { + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/@cloudflare/unenv-preset/-/unenv-preset-2.16.2.tgz", + "integrity": "sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ==", + "dev": true, + "license": "MIT OR Apache-2.0", + "peerDependencies": { + "unenv": "2.0.0-rc.24", + "workerd": ">1.20260305.0 <2.0.0-0" + }, + "peerDependenciesMeta": { + "workerd": { + "optional": true + } + } + }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20261117.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20261117.1.tgz", + "integrity": "sha512-qfAYw6iPoey0BmPsp4z5ARWOa+XSBD3gQzmcBI2ql9pKTSA5eEC8F1oI6BIk/FVguhomfSn5gS4RzbWhTd/EpQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20261117.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20261117.1.tgz", + "integrity": "sha512-cInx5Cr9O27oW+ujyI49lTRQZra/lMgWUFiKmGY3jxDncATSxzfQ6udXHkVvK4//1/PfxQTDyMjdQUIN8m6Aqg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20261117.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20261117.1.tgz", + "integrity": "sha512-gZLA8X11m/luZwn+YA3+mDu61vdxNJzpksP/QZqjydKTQ+VUCulsK5gtn9Bqst1p3KJu2kafQpJ1nDQv4B23jA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20261117.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20261117.1.tgz", + "integrity": "sha512-gxWngFojq41ULKNKb9rpWYvKotN5hT2I/xot+Bpy31cXzrwcTgtDLSMb2t75sW5BJxH7hihFvikgYb577kB3Zg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20261117.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20261117.1.tgz", + "integrity": "sha512-0OR2Btx5EDonOKvvuGDq8rxBSggxoF1ThQjbZN3vsu3GlaF/oXW5f9/iB78OgV0CzMPTi+hZgzc1NR95UJCURA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workers-utils": { + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-utils/-/workers-utils-0.56.0.tgz", + "integrity": "sha512-Fw3/zR+pQp+5hKn1CHIRkCYz49fyAb2qRqCq01jBGqlKL0rRnZyXYD4j0h9cjaWPYYQUOe5y6L7BNp2ZwsHg5A==", + "dev": true, + "license": "MIT OR Apache-2.0", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "chalk": "5.3.0", + "dotenv": "16.3.1", + "undici": "7.30.2" + }, + "peerDependencies": { + "vitest": "^4.1.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "vitest": { + "optional": true + } + } + }, + "node_modules/@cloudflare/workers-utils/node_modules/undici": { + "version": "7.30.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.2.tgz", + "integrity": "sha512-mLyPQnHwUxaM/rideoK/+KL8DaAJLRl4aBCfmX444aCSLnIaomqPLtNRe2jdCYcsk5wZzXrDIQC8ZeYNRAYyIA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", + "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@poppinss/colors": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@poppinss/colors/-/colors-4.1.6.tgz", + "integrity": "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^4.1.5" + } + }, + "node_modules/@poppinss/dumper": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@poppinss/dumper/-/dumper-0.6.5.tgz", + "integrity": "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@sindresorhus/is": "^7.0.2", + "supports-color": "^10.0.0" + } + }, + "node_modules/@poppinss/exception": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@poppinss/exception/-/exception-1.2.3.tgz", + "integrity": "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sindresorhus/is": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.2.0.tgz", + "integrity": "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@speed-highlight/core": { + "version": "1.2.24", + "resolved": "https://registry.npmjs.org/@speed-highlight/core/-/core-1.2.24.tgz", + "integrity": "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/@types/node": { + "version": "18.19.130", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.130.tgz", + "integrity": "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/node-fetch": { + "version": "2.6.13", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.13.tgz", + "integrity": "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.4" + } + }, + "node_modules/@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/agentkeepalive": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz", + "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/blake3-wasm": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", + "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", + "dev": true, + "license": "MIT" + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/cf": { + "version": "1.0.0-rc.1", + "resolved": "https://registry.npmjs.org/cf/-/cf-1.0.0-rc.1.tgz", + "integrity": "sha512-mQ9X/FVE1QP2ebXVF/9tlbqoO0TB3tKxUJocaWsic6IuNvThmJc/Ou/4ABJNB/Sj8HxEzvrjT1PRqjySVO5YoA==", + "dev": true, + "license": "MIT OR Apache-2.0", + "dependencies": { + "@cloudflare/build-output-utils": "1.0.0-rc.1", + "@cloudflare/config": "1.0.0-rc.1", + "@cloudflare/runtime-types": "0.1.30", + "blake3-wasm": "2.1.5", + "miniflare": "5.20261117.0-beta" + }, + "bin": { + "cf": "bin/cf", + "cloudflare": "bin/cf" + }, + "engines": { + "node": "^22.23.0 || ^24.22.0 || ^26.12.0" + } + }, + "node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cloudflare": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/cloudflare/-/cloudflare-5.2.0.tgz", + "integrity": "sha512-dVzqDpPFYR9ApEC9e+JJshFJZXcw4HzM8W+3DHzO5oy9+8rLC53G7x6fEf9A7/gSuSCxuvndzui5qJKftfIM9A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devtools-protocol": { + "version": "0.0.1182435", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1182435.tgz", + "integrity": "sha512-EmlkWb62wSbQNE1gRZZsi4KZYRaF5Skpp183LhRU7+sadKR06O1dHCjZmFSEG6Kv7P6S/UYLxcY3NlYwqKM99w==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/error-stack-parser-es": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/error-stack-parser-es/-/error-stack-parser-es-1.0.5.tgz", + "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data-encoder": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", + "dev": true, + "license": "MIT" + }, + "node_modules/formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + }, + "engines": { + "node": ">= 12.20" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/miniflare": { + "version": "5.20261117.0-beta", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20261117.0-beta.tgz", + "integrity": "sha512-D2ygY04wQUmbpwgBhj828piErZoj7UMlXNGr4EWQp/c1PNGHyYOh0dMIyobjwOXiD5Ifl1EaEVAoNuBHK+qtkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "sharp": "0.35.5", + "undici": "7.30.1", + "workerd": "1.20261117.1", + "ws": "8.21.0", + "youch": "4.1.0-beta.10" + }, + "engines": { + "node": ">=22.12.0" + }, + "peerDependencies": { + "kerberos": "^2.0.0" + }, + "peerDependenciesMeta": { + "kerberos": { + "optional": true + } + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "deprecated": "Use your platform's native DOMException instead", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/undici": { + "version": "7.30.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz", + "integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "license": "MIT" + }, + "node_modules/unenv": { + "version": "2.0.0-rc.24", + "resolved": "https://registry.npmjs.org/unenv/-/unenv-2.0.0-rc.24.tgz", + "integrity": "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pathe": "^2.0.3" + } + }, + "node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/workerd": { + "version": "1.20261117.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20261117.1.tgz", + "integrity": "sha512-iakDbGVtJRiErpWSM5fYT0z3spJ2Mo1x/POsEajBNLqUbTRwm8vMqbB7g8zPN2tzs6eZYNiO5ECyEnAXO9Foxw==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20261117.1", + "@cloudflare/workerd-darwin-arm64": "1.20261117.1", + "@cloudflare/workerd-linux-64": "1.20261117.1", + "@cloudflare/workerd-linux-arm64": "1.20261117.1", + "@cloudflare/workerd-windows-64": "1.20261117.1" + } + }, + "node_modules/wrangler": { + "version": "4.166.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-4.166.0.tgz", + "integrity": "sha512-qMz0sHGXqEC0Va8T6dAaG0ggp9tCcuHHYMUQzRKbtZg6+MPAPb6oBu1757IaeugNJHPAz+twHiA+zDyXWQLsLw==", + "dev": true, + "license": "MIT OR Apache-2.0", + "dependencies": { + "@cloudflare/kv-asset-handler": "0.5.1", + "@cloudflare/unenv-preset": "2.16.2", + "@cloudflare/workers-utils": "0.56.0", + "@cspotcode/source-map-support": "0.8.1", + "@types/yargs": "17.0.24", + "cloudflare": "5.2.0", + "devtools-protocol": "0.0.1182435", + "esbuild": "0.28.2", + "miniflare": "5.20261119.0-beta", + "path-to-regexp": "6.3.0", + "undici": "7.30.2", + "unenv": "2.0.0-rc.24", + "workerd": "1.20261119.1" + }, + "bin": { + "cf-wrangler": "bin/cf-wrangler.js", + "wrangler": "bin/wrangler.js", + "wrangler2": "bin/wrangler.js" + }, + "engines": { + "node": ">=22.12.0" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "@cloudflare/workers-types": "^5.20261119.1" + }, + "peerDependenciesMeta": { + "@cloudflare/workers-types": { + "optional": true + } + } + }, + "node_modules/wrangler/node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20261119.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20261119.1.tgz", + "integrity": "sha512-yotoiTGXCl1gTRX+y5ZWSAmzAg6CcBJXhJL6C1DGWUhsjjezNe8FdzraNsefVTOeKsOid2EC+hqOzewczKLvmQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/wrangler/node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20261119.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20261119.1.tgz", + "integrity": "sha512-VPOmfEmMubvw4SPcg/yDgamQXsiVAENgxeCJO8pDggRJFaF93SP0g/hktD8sbfmWBS19BO1kX1EsdgHSgRL9jA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/wrangler/node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20261119.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20261119.1.tgz", + "integrity": "sha512-aaDf78smiN12Uuwtg6TG6iLVS61sLpy/7DC5PYORf2+TCYw/bygcaqqb8zQJ+XwZ3xYhm/Ws80c/yMMhCMTFYA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/wrangler/node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20261119.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20261119.1.tgz", + "integrity": "sha512-LkyAvTMcKqRUP73HRScWWwTSz3pw09um1hxR+rcGdvsGzao8IR59XXTp/tul6kFdVBL2mD8U3X6j2O8t7I4viw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/wrangler/node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20261119.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20261119.1.tgz", + "integrity": "sha512-y4RO3QFNWt4j4uq2kmP5tklTvdA3qOA0PXuA66vsCmEtZYYb71ldefJcq5Dt0jrexKf/i4BBaLXZMVYLnohb0g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/wrangler/node_modules/miniflare": { + "version": "5.20261119.0-beta", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20261119.0-beta.tgz", + "integrity": "sha512-HdNQIUPgde5Yg0qFaI6iiYd0aOxAgKQTXDstkBN2G1tPBdslNrUKdySwaGdBix0IFd+yh8M0gkqzw68dIZ2Ugw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "sharp": "0.35.5", + "undici": "7.30.2", + "workerd": "1.20261119.1", + "ws": "8.21.0", + "youch": "4.1.0-beta.10" + }, + "engines": { + "node": ">=22.12.0" + }, + "peerDependencies": { + "kerberos": "^2.0.0" + }, + "peerDependenciesMeta": { + "kerberos": { + "optional": true + } + } + }, + "node_modules/wrangler/node_modules/undici": { + "version": "7.30.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.2.tgz", + "integrity": "sha512-mLyPQnHwUxaM/rideoK/+KL8DaAJLRl4aBCfmX444aCSLnIaomqPLtNRe2jdCYcsk5wZzXrDIQC8ZeYNRAYyIA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/wrangler/node_modules/workerd": { + "version": "1.20261119.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20261119.1.tgz", + "integrity": "sha512-lalSvY+ad5asqMgzA/DfrZo7wvuvOHJc/aS1UctUrwu76fJE/LkSKJlprfBu0LeU79Qai5d+xFooQA9CIfj+dQ==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20261119.1", + "@cloudflare/workerd-darwin-arm64": "1.20261119.1", + "@cloudflare/workerd-linux-64": "1.20261119.1", + "@cloudflare/workerd-linux-arm64": "1.20261119.1", + "@cloudflare/workerd-windows-64": "1.20261119.1" + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/youch": { + "version": "4.1.0-beta.10", + "resolved": "https://registry.npmjs.org/youch/-/youch-4.1.0-beta.10.tgz", + "integrity": "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@poppinss/dumper": "^0.6.4", + "@speed-highlight/core": "^1.2.7", + "cookie": "^1.0.2", + "youch-core": "^0.3.3" + } + }, + "node_modules/youch-core": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/youch-core/-/youch-core-0.3.3.tgz", + "integrity": "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/exception": "^1.2.2", + "error-stack-parser-es": "^1.0.5" + } + }, + "node_modules/zod": { + "version": "4.6.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.6.tgz", + "integrity": "sha512-4UmzQUF5fxvfcYHlbjBmejU+w+hbDnWFx4aS8kBx7nPBHcO2SqPbpAG8snbdg+Xse4pRefR98hgjFgIMCI/UhA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/.github/worker-deploy-ci/package.json b/.github/worker-deploy-ci/package.json new file mode 100644 index 0000000000..9cddc3865a --- /dev/null +++ b/.github/worker-deploy-ci/package.json @@ -0,0 +1,17 @@ +{ + "name": "github-ci-worker-deployment-toolchain", + "version": "0.1.0", + "private": true, + "type": "module", + "engines": { + "node": "24.22.0" + }, + "scripts": { + "build": "cf build", + "test:offline": "node --test test/deployment-config.test.mjs test/deployment-guard.test.mjs" + }, + "devDependencies": { + "cf": "1.0.0-rc.1", + "wrangler": "4.166.0" + } +} diff --git a/.github/worker-deploy-ci/test/deployment-config.test.mjs b/.github/worker-deploy-ci/test/deployment-config.test.mjs new file mode 100644 index 0000000000..2827f4f06f --- /dev/null +++ b/.github/worker-deploy-ci/test/deployment-config.test.mjs @@ -0,0 +1,71 @@ +import assert from "node:assert/strict"; +import { readFile, readdir } from "node:fs/promises"; +import test from "node:test"; + +const read = (path) => readFile(new URL(path, import.meta.url), "utf8"); +const SECRET_BINDINGS = [ + "GITHUB_WEBHOOK_SECRET", + "TURSO_PLATFORM_TOKEN", + "TURSO_QUEUE_TOKEN", + "EVENTS_BROKER_TOKEN", + "EVENTS_BROKER_ACCESS_CLIENT_ID", + "EVENTS_BROKER_ACCESS_CLIENT_SECRET", +]; + +test("cf config declares the production non-secret bindings and only secret names", async () => { + const config = await read("../cloudflare.config.ts"); + const wrangler = await read("../../../pkgs/github-ci/worker/wrangler.toml"); + assert.match(config, /name:\s*"github-ci"/); + assert.match(config, /compatibilityDate:\s*"2025-09-15"/); + assert.match(config, /workersDev:\s*true/); + assert.match(config, /\.\.\/\.\.\/pkgs\/github-ci\/worker\/src\/index\.ts/); + assert.doesNotMatch(config, /previewUrls\s*:/); + for (const [name, value] of [ + ["TURSO_PLATFORM_URL", "https://fleet-platform-dezren39.aws-us-east-1.turso.io"], + ["TURSO_QUEUE_URL", "https://fleet-queue-dezren39.aws-us-east-1.turso.io"], + ["EVENTS_BROKER_URL", "https://queue-broker.security.cab"], + ]) { + assert.match(wrangler, new RegExp(`${name}\\s*=\\s*"${value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}"`)); + assert.match(config, new RegExp(`${name}:\\s*bindings\\.text\\("${value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}"\\)`)); + } + for (const name of SECRET_BINDINGS) assert.match(config, new RegExp(`${name}:\\s*bindings\\.secret\\(\\)`)); + assert.doesNotMatch(config, /bindings\.secret\([^)]/); +}); + +test("Build Output v1 was made by pinned Wrangler and preserves value-free secret names", async () => { + const root = JSON.parse(await read("../.cloudflare/output/v1/config.json")); + const worker = JSON.parse(await read("../.cloudflare/output/v1/workers/default/worker.config.json")); + assert.deepEqual(root.producer, { name: "wrangler", version: "4.166.0" }); + assert.equal(worker.name, "github-ci"); + assert.equal(worker.workersDev, true); + assert.equal(Object.hasOwn(worker, "previewUrls"), false); + for (const name of SECRET_BINDINGS) { + assert.deepEqual(worker.env[name], { type: "secret" }); + } +}); + +test("locked toolchain uses the cf release candidate with matching Build Output v1", async () => { + const pkg = JSON.parse(await read("../package.json")); + const lock = JSON.parse(await read("../package-lock.json")); + const workerPkg = JSON.parse(await read("../../../pkgs/github-ci/worker/package.json")); + const workerLock = JSON.parse(await read("../../../pkgs/github-ci/worker/package-lock.json")); + assert.equal(pkg.engines.node, "24.22.0"); + assert.equal(pkg.devDependencies.cf, "1.0.0-rc.1"); + assert.equal(lock.packages["node_modules/cf"].version, pkg.devDependencies.cf); + assert.equal(pkg.devDependencies.wrangler, "4.166.0"); + assert.equal(lock.packages["node_modules/wrangler"].version, pkg.devDependencies.wrangler); + assert.equal(lock.packages["node_modules/@cloudflare/build-output-utils"].version, "1.0.0-rc.1"); + assert.equal(workerPkg.scripts.deploy, "wrangler deploy"); + assert.equal(workerPkg.devDependencies.wrangler, "4.59.1"); + assert.equal(Object.hasOwn(workerPkg.devDependencies, "cf"), false); + assert.equal(workerLock.packages["node_modules/wrangler"].version, "4.59.1"); +}); + +test("pinned cf Versions upload requires strict inheritance resolution", async () => { + const distUrl = new URL("../node_modules/cf/dist/", import.meta.url); + const files = await readdir(distUrl); + const uploadModules = files.filter((file) => file.startsWith("static-assets-") && file.endsWith(".mjs")); + assert.ok(uploadModules.length > 0, "cf upload implementation module is present"); + const source = (await Promise.all(uploadModules.map((file) => readFile(new URL(file, distUrl), "utf8")))).join("\n"); + assert.match(source, /bindings_inherit:\s*`strict`/); +}); diff --git a/.github/worker-deploy-ci/test/deployment-guard.test.mjs b/.github/worker-deploy-ci/test/deployment-guard.test.mjs new file mode 100644 index 0000000000..7b281aeb99 --- /dev/null +++ b/.github/worker-deploy-ci/test/deployment-guard.test.mjs @@ -0,0 +1,378 @@ +import assert from "node:assert/strict"; +import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { spawnSync } from "node:child_process"; +import test from "node:test"; + +const SCRIPT = new URL("../../../pkgs/github-ci/worker/scripts/deployment-guard.mjs", import.meta.url); +const SHA = "5f4dcc3b5aa765d61d8327deb882cf9921f7e3e0"; +const RUN_ID = "123456789"; +const RUN_ATTEMPT = "2"; +const VERSION_ID = "01234567-89ab-cdef-0123-456789abcdef"; +const BASELINE_VERSION_ID = "11234567-89ab-cdef-0123-456789abcdef"; +const BASELINE_DEPLOYMENT_ID = "21234567-89ab-cdef-0123-456789abcdef"; +const DEPLOYMENT_ID = "31234567-89ab-cdef-0123-456789abcdef"; +const BRANCH_POLICY_ID = 77; +const SECRET_NAMES = [ + "GITHUB_WEBHOOK_SECRET", + "TURSO_PLATFORM_TOKEN", + "TURSO_QUEUE_TOKEN", + "EVENTS_BROKER_TOKEN", + "EVENTS_BROKER_ACCESS_CLIENT_ID", + "EVENTS_BROKER_ACCESS_CLIENT_SECRET", +]; + +function version(id, createdOn, overrides = {}) { + return { + id, + created_on: createdOn, + annotations: { + "workers/tag": `git-${SHA.slice(0, 12)}`, + "workers/message": `github-ci candidate ${SHA}`, + }, + bindings: SECRET_NAMES.map((name) => ({ name, type: "secret_text" })), + ...overrides, + }; +} + +function baselineDeployment(overrides = {}) { + return { + id: BASELINE_DEPLOYMENT_ID, + created_on: "2026-11-22T12:00:00.000Z", + versions: [{ version_id: BASELINE_VERSION_ID, percentage: 100 }], + ...overrides, + }; +} + +function candidateReceipt() { + return { + schema: "github-ci-worker-upload-receipt/v1", + upload: { + repository: "developing-today/code", + workflow_path: ".github/workflows/github-ci-worker-upload.yml", + workflow_ref: "developing-today/code/.github/workflows/github-ci-worker-upload.yml@refs/heads/main", + event: "workflow_dispatch", + ref: "refs/heads/main", + run_id: RUN_ID, + run_attempt: Number(RUN_ATTEMPT), + source_sha: SHA, + artifact_name: `github-ci-candidate-${RUN_ID}-${RUN_ATTEMPT}`, + }, + baseline: { + deployment_id: BASELINE_DEPLOYMENT_ID, + version_id: BASELINE_VERSION_ID, + created_on: "2026-11-22T12:00:00.000Z", + }, + candidate: { + version_id: VERSION_ID, + created_on: "2026-11-22T12:05:00.000Z", + tag: `git-${SHA.slice(0, 12)}`, + message: `github-ci candidate ${SHA}`, + secret_bindings: SECRET_NAMES.map((name) => ({ name, type: "secret_text" })), + }, + }; +} + +function writeJson(path, value) { + writeFileSync(path, JSON.stringify(value)); +} + +function run(root, args, env = {}) { + return spawnSync(process.execPath, [SCRIPT.pathname, ...args], { + cwd: root, + encoding: "utf8", + env: { ...process.env, ...env }, + }); +} + +function temp(t) { + const root = mkdtempSync(join(tmpdir(), "github-ci-guard-")); + t.after(() => rmSync(root, { recursive: true, force: true })); + return root; +} + +function uploadEnv(root) { + return { + GITHUB_REPOSITORY: "developing-today/code", + GITHUB_EVENT_NAME: "workflow_dispatch", + GITHUB_REF: "refs/heads/main", + GITHUB_SHA: SHA, + GITHUB_RUN_ID: RUN_ID, + GITHUB_RUN_ATTEMPT: RUN_ATTEMPT, + GITHUB_WORKFLOW_REF: "developing-today/code/.github/workflows/github-ci-worker-upload.yml@refs/heads/main", + GITHUB_OUTPUT: join(root, "output"), + GITHUB_STEP_SUMMARY: join(root, "summary"), + }; +} + +test("detached environment gate requires reviewers, self-review prevention, no admin bypass, and typed main", (t) => { + const root = temp(t); + const environmentPath = join(root, "environment.json"); + const policyListPath = join(root, "policy-list.json"); + const policyPath = join(root, "policy.json"); + const environment = { + name: "github-ci-production", + can_admins_bypass: false, + protection_rules: [{ + type: "required_reviewers", + prevent_self_review: true, + reviewers: [{ type: "User", reviewer: { id: 123, login: "reviewer" } }], + }], + deployment_branch_policy: { protected_branches: false, custom_branch_policies: true }, + }; + writeJson(environmentPath, environment); + writeJson(policyListPath, { total_count: 1, branch_policies: [{ id: BRANCH_POLICY_ID, name: "main" }] }); + writeJson(policyPath, { id: BRANCH_POLICY_ID, name: "main", type: "branch" }); + + const outputPath = join(root, "output"); + const selected = run(root, ["select-branch-policy", policyListPath], { GITHUB_OUTPUT: outputPath }); + assert.equal(selected.status, 0, selected.stderr); + assert.match(readFileSync(outputPath, "utf8"), new RegExp(`branch_policy_id=${BRANCH_POLICY_ID}`)); + const verified = run(root, ["check-environment", environmentPath, policyPath, "github-ci-production", String(BRANCH_POLICY_ID)], { + GITHUB_OUTPUT: outputPath, + }); + assert.equal(verified.status, 0, verified.stderr); + assert.match(readFileSync(outputPath, "utf8"), /environment_name=github-ci-production/); + + for (const badEnvironment of [ + { ...environment, protection_rules: [] }, + { ...environment, protection_rules: [{ ...environment.protection_rules[0], prevent_self_review: false }] }, + { ...environment, can_admins_bypass: true }, + { ...environment, can_admins_bypass: undefined }, + ]) { + writeJson(environmentPath, badEnvironment); + const failed = run(root, ["check-environment", environmentPath, policyPath, "github-ci-production", String(BRANCH_POLICY_ID)], { + GITHUB_OUTPUT: join(root, "failed-output"), + }); + assert.notEqual(failed.status, 0); + assert.equal(existsSync(join(root, "failed-output")), false, "failed gate must not emit an environment name"); + } + + writeJson(environmentPath, environment); + for (const badPolicy of [ + { id: BRANCH_POLICY_ID, name: "main", type: "tag" }, + { id: BRANCH_POLICY_ID + 1, name: "main", type: "branch" }, + { id: BRANCH_POLICY_ID, name: "release/*", type: "branch" }, + { id: BRANCH_POLICY_ID, name: "main" }, + ]) { + writeJson(policyPath, badPolicy); + assert.notEqual(run(root, ["check-environment", environmentPath, policyPath, "github-ci-production", String(BRANCH_POLICY_ID)], { + GITHUB_OUTPUT: join(root, "bad-policy-output"), + }).status, 0); + } + + writeJson(policyPath, { id: BRANCH_POLICY_ID, name: "main", type: "branch" }); + for (const badList of [ + { total_count: 0, branch_policies: [] }, + { total_count: 2, branch_policies: [{ id: BRANCH_POLICY_ID, name: "main" }, { id: 78, name: "main" }] }, + { total_count: 1, branch_policies: [{ id: BRANCH_POLICY_ID, name: "main" }, { id: 78, name: "main" }] }, + { total_count: 1, branch_policies: [{ id: BRANCH_POLICY_ID, name: "main" }] }, + ]) { + writeJson(policyListPath, badList); + const listOutput = join(root, "list-output"); + const failed = run(root, ["select-branch-policy", policyListPath], { GITHUB_OUTPUT: listOutput }); + if (badList.branch_policies.length !== 1 || badList.total_count !== 1) { + assert.notEqual(failed.status, 0); + assert.equal(existsSync(listOutput), false); + } else { + assert.equal(failed.status, 0, failed.stderr); + } + } +}); + +test("baseline and uploaded candidate receipt preserve exact IDs, attempts, provenance, and binding names", (t) => { + const root = temp(t); + const baselinePath = join(root, "baseline-deployments.json"); + const baselineVersionPath = join(root, "baseline-version.json"); + const createResponsePath = join(root, "create-response.json"); + const candidatePath = join(root, "candidate-version.json"); + const receiptPath = join(root, "upload-receipt.json"); + const runPath = join(root, "run-attempt.json"); + writeJson(baselinePath, { result: { deployments: [baselineDeployment()] } }); + writeJson(baselineVersionPath, { result: version(BASELINE_VERSION_ID, "2026-11-22T11:59:00.000Z", { annotations: {} }) }); + writeJson(createResponsePath, { success: true, result: { id: VERSION_ID } }); + writeJson(candidatePath, { result: version(VERSION_ID, "2026-11-22T12:05:00.000Z") }); + + const env = uploadEnv(root); + const selected = run(root, ["select-upload-result", createResponsePath], env); + assert.equal(selected.status, 0, selected.stderr); + assert.match(readFileSync(env.GITHUB_OUTPUT, "utf8"), new RegExp(`version_id=${VERSION_ID}`)); + + const invalidCreateResponsePath = join(root, "invalid-create-response.json"); + writeJson(invalidCreateResponsePath, { success: true, result: { metadata: {} } }); + assert.notEqual(run(root, ["select-upload-result", invalidCreateResponsePath], env).status, 0); + + const written = run(root, ["write-upload-receipt", baselinePath, baselineVersionPath, createResponsePath, candidatePath, receiptPath], env); + assert.equal(written.status, 0, written.stderr); + const receipt = JSON.parse(readFileSync(receiptPath, "utf8")); + assert.equal(receipt.upload.run_id, RUN_ID); + assert.equal(receipt.upload.run_attempt, Number(RUN_ATTEMPT)); + assert.equal(receipt.baseline.deployment_id, BASELINE_DEPLOYMENT_ID); + assert.equal(receipt.baseline.version_id, BASELINE_VERSION_ID); + assert.deepEqual(receipt.candidate.secret_bindings.map((binding) => binding.name), SECRET_NAMES); + assert.doesNotMatch(readFileSync(receiptPath, "utf8"), /secret_text.*value|"value"/); + + writeJson(invalidCreateResponsePath, { success: true, result: { id: BASELINE_VERSION_ID } }); + assert.notEqual(run(root, ["write-upload-receipt", baselinePath, baselineVersionPath, invalidCreateResponsePath, candidatePath, join(root, "wrong-create-receipt.json")], env).status, 0); + + writeJson(runPath, { + id: Number(RUN_ID), + run_attempt: Number(RUN_ATTEMPT), + path: ".github/workflows/github-ci-worker-upload.yml@main", + event: "workflow_dispatch", + head_branch: "main", + head_sha: SHA, + status: "completed", + conclusion: "success", + repository: { full_name: "developing-today/code" }, + }); + const verified = run(root, ["verify-upload-receipt", receiptPath, runPath, RUN_ID, RUN_ATTEMPT, VERSION_ID, BASELINE_DEPLOYMENT_ID, BASELINE_VERSION_ID], env); + assert.equal(verified.status, 0, verified.stderr); + assert.match(readFileSync(env.GITHUB_OUTPUT, "utf8"), new RegExp(`source_sha=${SHA}`)); + + assert.notEqual(run(root, ["verify-upload-receipt", receiptPath, runPath, RUN_ID, "1", VERSION_ID, BASELINE_DEPLOYMENT_ID, BASELINE_VERSION_ID], env).status, 0); + assert.notEqual(run(root, ["verify-upload-receipt", receiptPath, runPath, RUN_ID, RUN_ATTEMPT, VERSION_ID, DEPLOYMENT_ID, BASELINE_VERSION_ID], env).status, 0); + assert.notEqual(run(root, ["verify-upload-receipt", join(root, "missing.json"), runPath, RUN_ID, RUN_ATTEMPT, VERSION_ID, BASELINE_DEPLOYMENT_ID, BASELINE_VERSION_ID], env).status, 0); +}); + +test("strict inheritance is fenced to the serving baseline, not another latest upload", (t) => { + const root = temp(t); + const deploymentsPath = join(root, "deployments.json"); + const versionsPath = join(root, "versions.json"); + writeJson(deploymentsPath, { result: { deployments: [baselineDeployment()] } }); + writeJson(versionsPath, { + result: { + items: [ + { id: BASELINE_VERSION_ID, metadata: { created_on: "2026-11-22T11:59:00.000Z" } }, + ], + }, + }); + const match = run(root, ["verify-inheritance-source", deploymentsPath, versionsPath]); + assert.equal(match.status, 0, match.stderr); + + writeJson(versionsPath, { + result: { + items: [ + { id: VERSION_ID, metadata: { created_on: "2026-11-22T12:01:00.000Z" } }, + ], + }, + }); + const mismatch = run(root, ["verify-inheritance-source", deploymentsPath, versionsPath]); + assert.notEqual(mismatch.status, 0); + assert.match(mismatch.stderr, /latest uploaded Worker Version is not the currently serving production baseline/); + + writeJson(versionsPath, { result: { items: [] } }); + assert.notEqual(run(root, ["verify-inheritance-source", deploymentsPath, versionsPath]).status, 0); + + writeJson(versionsPath, { + result: { + items: [ + { id: BASELINE_VERSION_ID, metadata: { created_on: "2026-11-22T11:59:00.000Z" } }, + { id: VERSION_ID, metadata: { created_on: "2026-11-22T12:01:00.000Z" } }, + ], + }, + }); + assert.notEqual(run(root, ["verify-inheritance-source", deploymentsPath, versionsPath]).status, 0); +}); + +test("version guards reject missing bindings and verify the existing active baseline", (t) => { + const root = temp(t); + const baselinePath = join(root, "baseline-deployments.json"); + const versionPath = join(root, "version.json"); + const outputPath = join(root, "output"); + writeJson(baselinePath, { result: [baselineDeployment()] }); + writeJson(versionPath, { result: version(BASELINE_VERSION_ID, "2026-11-22T11:59:00.000Z", { annotations: {} }) }); + const good = run(root, ["verify-baseline", baselinePath, versionPath], { GITHUB_OUTPUT: outputPath }); + assert.equal(good.status, 0, good.stderr); + assert.match(readFileSync(outputPath, "utf8"), new RegExp(`baseline_deployment_id=${BASELINE_DEPLOYMENT_ID}`)); + + writeJson(versionPath, { result: version(BASELINE_VERSION_ID, "2026-11-22T11:59:00.000Z", { bindings: [] }) }); + assert.notEqual(run(root, ["verify-baseline", baselinePath, versionPath], { GITHUB_OUTPUT: outputPath }).status, 0); + + const receiptPath = join(root, "receipt.json"); + writeJson(receiptPath, candidateReceipt()); + const changed = { deployments: [baselineDeployment({ id: DEPLOYMENT_ID, created_on: "2026-11-23T12:00:00.000Z" })] }; + writeJson(baselinePath, changed); + assert.notEqual(run(root, ["verify-baseline-current", baselinePath, receiptPath]).status, 0); +}); + +test("version guard accepts Cloudflare env-map reads without secret values", (t) => { + const root = temp(t); + const versionPath = join(root, "version.json"); + writeJson(versionPath, { + result: { + ...version(VERSION_ID, "2026-11-22T12:05:00.000Z"), + bindings: undefined, + env: Object.fromEntries(SECRET_NAMES.map((name) => [name, { type: "secret_text" }])), + }, + }); + const result = run(root, ["verify-version", versionPath, VERSION_ID, SHA], { + GITHUB_OUTPUT: join(root, "output"), + GITHUB_STEP_SUMMARY: join(root, "summary"), + }); + assert.equal(result.status, 0, result.stderr); + assert.doesNotMatch(readFileSync(join(root, "summary"), "utf8"), /secret_text/); +}); + +test("promotion needs the exact create receipt and latest 100 percent deployment read-back", (t) => { + const root = temp(t); + const receiptPath = join(root, "upload-receipt.json"); + const createdPath = join(root, "created.json"); + const deploymentsPath = join(root, "deployments.json"); + const outputPath = join(root, "output"); + const summaryPath = join(root, "summary"); + writeJson(receiptPath, candidateReceipt()); + const created = { + id: DEPLOYMENT_ID, + created_on: "2026-11-23T12:00:00.000Z", + versions: [{ version_id: VERSION_ID, percentage: 100 }], + }; + writeJson(createdPath, { result: created }); + writeJson(deploymentsPath, { result: { deployments: [created, baselineDeployment()] } }); + + const createdResult = run(root, ["verify-created-deployment", createdPath, receiptPath], { + GITHUB_OUTPUT: outputPath, + GITHUB_STEP_SUMMARY: summaryPath, + }); + assert.equal(createdResult.status, 0, createdResult.stderr); + assert.match(readFileSync(outputPath, "utf8"), new RegExp(`deployment_id=${DEPLOYMENT_ID}`)); + const readback = run(root, ["verify-promotion-readback", deploymentsPath, receiptPath, createdPath], { + GITHUB_OUTPUT: outputPath, + GITHUB_STEP_SUMMARY: summaryPath, + }); + assert.equal(readback.status, 0, readback.stderr); + + const wrongId = { ...created, id: "41234567-89ab-cdef-0123-456789abcdef" }; + writeJson(createdPath, { result: wrongId }); + assert.notEqual(run(root, ["verify-promotion-readback", deploymentsPath, receiptPath, createdPath], { GITHUB_OUTPUT: outputPath }).status, 0); + writeJson(createdPath, { result: created }); + writeJson(deploymentsPath, { result: { deployments: [{ ...created, versions: [{ version_id: BASELINE_VERSION_ID, percentage: 100 }] }, baselineDeployment()] } }); + assert.notEqual(run(root, ["verify-promotion-readback", deploymentsPath, receiptPath, createdPath], { GITHUB_OUTPUT: outputPath }).status, 0); + + writeJson(deploymentsPath, { result: { deployments: [created, baselineDeployment()] } }); + const promotionReceiptPath = join(root, "promotion-receipt.json"); + const promotionOutput = { + GITHUB_REPOSITORY: "developing-today/code", + GITHUB_EVENT_NAME: "workflow_dispatch", + GITHUB_REF: "refs/heads/main", + GITHUB_WORKFLOW_REF: "developing-today/code/.github/workflows/github-ci-worker-promote.yml@refs/heads/main", + GITHUB_RUN_ID: "987654321", + GITHUB_RUN_ATTEMPT: "1", + GITHUB_OUTPUT: outputPath, + GITHUB_STEP_SUMMARY: summaryPath, + }; + const receiptResult = run(root, ["write-promotion-receipt", receiptPath, createdPath, deploymentsPath, promotionReceiptPath], promotionOutput); + assert.equal(receiptResult.status, 0, receiptResult.stderr); + const promotionReceipt = JSON.parse(readFileSync(promotionReceiptPath, "utf8")); + assert.equal(promotionReceipt.upload.run_attempt, Number(RUN_ATTEMPT)); + assert.equal(promotionReceipt.baseline.deployment_id, BASELINE_DEPLOYMENT_ID); + assert.equal(promotionReceipt.deployment.id, DEPLOYMENT_ID); + assert.equal(promotionReceipt.deployment.percentage, 100); +}); + +test("CLI rejects unknown arguments before reading inputs", () => { + const result = run(process.cwd(), ["verify-version", "--dry-rnu", "/does/not/exist", "bad"]); + assert.equal(result.status, 2); + assert.match(result.stderr, /Unknown option/); +}); diff --git a/.github/workflows/github-ci-worker-promote.yml b/.github/workflows/github-ci-worker-promote.yml new file mode 100644 index 0000000000..4f383c3c20 --- /dev/null +++ b/.github/workflows/github-ci-worker-promote.yml @@ -0,0 +1,326 @@ +name: github-ci Worker version promotion + +# Manual, default-off promotion. The exact successful upload attempt, +# baseline deployment and deployment create/read-back receipts are required. +on: + workflow_dispatch: + inputs: + confirm_promotion: + description: Set true to opt in to protected production promotion + required: true + type: boolean + default: false + upload_run_id: + description: Successful upload workflow run ID + required: false + type: string + upload_run_attempt: + description: Exact upload workflow run attempt number + required: false + type: string + version_id: + description: Candidate Workers Version UUID from that receipt + required: false + type: string + baseline_deployment_id: + description: Baseline Deployment UUID from that receipt + required: false + type: string + baseline_version_id: + description: Baseline Worker Version UUID from that receipt + required: false + type: string + +permissions: + actions: read + contents: read + +concurrency: + group: github-ci-worker-production + cancel-in-progress: false + +jobs: + check-production-environment: + if: github.repository == 'developing-today/code' && github.ref == 'refs/heads/main' && inputs.confirm_promotion == true + runs-on: ubuntu-24.04 + timeout-minutes: 5 + outputs: + environment_name: ${{ steps.verify.outputs.environment_name }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.sha }} + persist-credentials: false + + - name: Read production environment and its only branch policy + id: policy + env: + GITHUB_TOKEN: ${{ github.token }} + ENVIRONMENT_NAME: github-ci-production + run: | + set -euo pipefail + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME" \ + > "$RUNNER_TEMP/production-environment.json" + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME/deployment-branch-policies" \ + > "$RUNNER_TEMP/production-branch-policies.json" + node pkgs/github-ci/worker/scripts/deployment-guard.mjs select-branch-policy \ + "$RUNNER_TEMP/production-branch-policies.json" + + - name: Verify production environment protection + id: verify + env: + GITHUB_TOKEN: ${{ github.token }} + ENVIRONMENT_NAME: github-ci-production + BRANCH_POLICY_ID: ${{ steps.policy.outputs.branch_policy_id }} + run: | + set -euo pipefail + [[ "$BRANCH_POLICY_ID" =~ ^[1-9][0-9]*$ ]] + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME/deployment-branch-policies/$BRANCH_POLICY_ID" \ + > "$RUNNER_TEMP/production-branch-policy.json" + node pkgs/github-ci/worker/scripts/deployment-guard.mjs check-environment \ + "$RUNNER_TEMP/production-environment.json" \ + "$RUNNER_TEMP/production-branch-policy.json" \ + "$ENVIRONMENT_NAME" "$BRANCH_POLICY_ID" + + promote: + needs: check-production-environment + if: github.repository == 'developing-today/code' && github.ref == 'refs/heads/main' && inputs.confirm_promotion == true && needs.check-production-environment.outputs.environment_name == 'github-ci-production' + runs-on: ubuntu-24.04 + timeout-minutes: 20 + environment: + name: ${{ needs.check-production-environment.outputs.environment_name }} + defaults: + run: + working-directory: .github/worker-deploy-ci + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.sha }} + fetch-depth: 0 + persist-credentials: false + + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 24.22.0 + cache: npm + cache-dependency-path: .github/worker-deploy-ci/package-lock.json + + - name: Read production environment and its only branch policy + id: policy + env: + GITHUB_TOKEN: ${{ github.token }} + ENVIRONMENT_NAME: ${{ needs.check-production-environment.outputs.environment_name }} + run: | + set -euo pipefail + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME" \ + > "$RUNNER_TEMP/production-environment.json" + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME/deployment-branch-policies" \ + > "$RUNNER_TEMP/production-branch-policies.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs select-branch-policy \ + "$RUNNER_TEMP/production-branch-policies.json" + + - name: Recheck production environment protection before provider access + env: + GITHUB_TOKEN: ${{ github.token }} + ENVIRONMENT_NAME: ${{ needs.check-production-environment.outputs.environment_name }} + BRANCH_POLICY_ID: ${{ steps.policy.outputs.branch_policy_id }} + run: | + set -euo pipefail + [[ "$BRANCH_POLICY_ID" =~ ^[1-9][0-9]*$ ]] + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME/deployment-branch-policies/$BRANCH_POLICY_ID" \ + > "$RUNNER_TEMP/production-branch-policy.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs check-environment \ + "$RUNNER_TEMP/production-environment.json" \ + "$RUNNER_TEMP/production-branch-policy.json" \ + "$ENVIRONMENT_NAME" "$BRANCH_POLICY_ID" + + - name: Install the isolated pinned cf toolchain + run: npm ci --ignore-scripts --no-audit --no-fund + + - name: Validate receipt input identifiers + id: inputs + env: + UPLOAD_RUN_ID: ${{ inputs.upload_run_id }} + UPLOAD_RUN_ATTEMPT: ${{ inputs.upload_run_attempt }} + VERSION_ID_INPUT: ${{ inputs.version_id }} + BASELINE_DEPLOYMENT_ID_INPUT: ${{ inputs.baseline_deployment_id }} + BASELINE_VERSION_ID_INPUT: ${{ inputs.baseline_version_id }} + run: | + set -euo pipefail + [[ "$UPLOAD_RUN_ID" =~ ^[1-9][0-9]*$ ]] + [[ "$UPLOAD_RUN_ATTEMPT" =~ ^[1-9][0-9]*$ ]] + [[ "$VERSION_ID_INPUT" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ ]] + [[ "$BASELINE_DEPLOYMENT_ID_INPUT" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ ]] + [[ "$BASELINE_VERSION_ID_INPUT" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ ]] + echo "upload_run_id=$UPLOAD_RUN_ID" >> "$GITHUB_OUTPUT" + echo "upload_run_attempt=$UPLOAD_RUN_ATTEMPT" >> "$GITHUB_OUTPUT" + echo "version_id=${VERSION_ID_INPUT,,}" >> "$GITHUB_OUTPUT" + echo "baseline_deployment_id=${BASELINE_DEPLOYMENT_ID_INPUT,,}" >> "$GITHUB_OUTPUT" + echo "baseline_version_id=${BASELINE_VERSION_ID_INPUT,,}" >> "$GITHUB_OUTPUT" + + - name: Download the receipt from that exact upload run attempt + uses: actions/download-artifact@v8 + with: + name: github-ci-candidate-${{ steps.inputs.outputs.upload_run_id }}-${{ steps.inputs.outputs.upload_run_attempt }} + path: ${{ runner.temp }}/github-ci-upload + run-id: ${{ steps.inputs.outputs.upload_run_id }} + repository: ${{ github.repository }} + github-token: ${{ github.token }} + + - name: Read the exact upload run attempt record + env: + GITHUB_TOKEN: ${{ github.token }} + UPLOAD_RUN_ID: ${{ steps.inputs.outputs.upload_run_id }} + UPLOAD_RUN_ATTEMPT: ${{ steps.inputs.outputs.upload_run_attempt }} + run: | + set -euo pipefail + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/actions/runs/$UPLOAD_RUN_ID/attempts/$UPLOAD_RUN_ATTEMPT" \ + > "$RUNNER_TEMP/github-ci-upload-run-attempt.json" + + - name: Verify exact upload attempt, candidate, and baseline receipt + id: receipt + env: + UPLOAD_RUN_ID: ${{ steps.inputs.outputs.upload_run_id }} + UPLOAD_RUN_ATTEMPT: ${{ steps.inputs.outputs.upload_run_attempt }} + VERSION_ID: ${{ steps.inputs.outputs.version_id }} + BASELINE_DEPLOYMENT_ID: ${{ steps.inputs.outputs.baseline_deployment_id }} + BASELINE_VERSION_ID: ${{ steps.inputs.outputs.baseline_version_id }} + run: | + set -euo pipefail + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-upload-receipt \ + "$RUNNER_TEMP/github-ci-upload/github-ci-upload-receipt.json" \ + "$RUNNER_TEMP/github-ci-upload-run-attempt.json" \ + "$UPLOAD_RUN_ID" "$UPLOAD_RUN_ATTEMPT" "$VERSION_ID" \ + "$BASELINE_DEPLOYMENT_ID" "$BASELINE_VERSION_ID" + + - name: Validate Cloudflare credential presence + env: + CF_PROMOTION_ACCOUNT_ID: ${{ secrets.CF_PROMOTION_ACCOUNT_ID }} + CF_PROMOTION_API_TOKEN: ${{ secrets.CF_PROMOTION_API_TOKEN }} + run: | + set -euo pipefail + [[ "$CF_PROMOTION_ACCOUNT_ID" =~ ^[0-9a-fA-F]{32}$ ]] + [[ -n "$CF_PROMOTION_API_TOKEN" ]] + + - name: Require the existing Worker + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_PROMOTION_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_PROMOTION_API_TOKEN }} + run: ./node_modules/.bin/cf -q workers get github-ci >/dev/null + + - name: Read candidate version and verify provenance and secret bindings + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_PROMOTION_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_PROMOTION_API_TOKEN }} + VERSION_ID: ${{ steps.inputs.outputs.version_id }} + SOURCE_SHA: ${{ steps.receipt.outputs.source_sha }} + run: | + set -euo pipefail + ./node_modules/.bin/cf workers versions get "$VERSION_ID" --worker github-ci \ + > "$RUNNER_TEMP/github-ci-candidate-version.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-version \ + "$RUNNER_TEMP/github-ci-candidate-version.json" "$VERSION_ID" "$SOURCE_SHA" + + - name: Require the source commit to remain on main history + env: + SOURCE_SHA: ${{ steps.receipt.outputs.source_sha }} + run: | + set -euo pipefail + git cat-file -e "${SOURCE_SHA}^{commit}" + git merge-base --is-ancestor "$SOURCE_SHA" "$GITHUB_SHA" + + - name: Fail if production baseline changed since upload + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_PROMOTION_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_PROMOTION_API_TOKEN }} + run: | + set -euo pipefail + ./node_modules/.bin/cf workers deployments list --worker github-ci \ + > "$RUNNER_TEMP/github-ci-current-deployments.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-baseline-current \ + "$RUNNER_TEMP/github-ci-current-deployments.json" \ + "$RUNNER_TEMP/github-ci-upload/github-ci-upload-receipt.json" + + - name: Require the selected version to be deployable + env: + CF_PROMOTION_ACCOUNT_ID: ${{ secrets.CF_PROMOTION_ACCOUNT_ID }} + CF_PROMOTION_API_TOKEN: ${{ secrets.CF_PROMOTION_API_TOKEN }} + VERSION_ID: ${{ steps.inputs.outputs.version_id }} + run: | + set -euo pipefail + curl --fail --silent --show-error --max-time 15 \ + -H "Authorization: Bearer $CF_PROMOTION_API_TOKEN" \ + "https://api.cloudflare.com/client/v4/accounts/$CF_PROMOTION_ACCOUNT_ID/workers/scripts/github-ci/versions?deployable=true" \ + > "$RUNNER_TEMP/github-ci-deployable.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-deployable \ + "$RUNNER_TEMP/github-ci-deployable.json" "$VERSION_ID" + + - name: Create a 100 percent deployment for the selected version + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_PROMOTION_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_PROMOTION_API_TOKEN }} + VERSION_ID: ${{ steps.inputs.outputs.version_id }} + run: | + set -euo pipefail + printf '[{"version_id":"%s","percentage":100}]\n' "$VERSION_ID" \ + > "$RUNNER_TEMP/github-ci-deployment-versions.json" + ./node_modules/.bin/cf workers deployments create \ + --worker github-ci --strategy percentage \ + --versions "@$RUNNER_TEMP/github-ci-deployment-versions.json" \ + > "$RUNNER_TEMP/github-ci-deployment-create.json" + + - name: Verify the exact deployment create and latest read-back + run: | + set -euo pipefail + ./node_modules/.bin/cf workers deployments list --worker github-ci \ + > "$RUNNER_TEMP/github-ci-deployments.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-promotion-readback \ + "$RUNNER_TEMP/github-ci-deployments.json" \ + "$RUNNER_TEMP/github-ci-upload/github-ci-upload-receipt.json" \ + "$RUNNER_TEMP/github-ci-deployment-create.json" + + - name: Write the exact promotion receipt + id: promotion-receipt + run: | + set -euo pipefail + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs write-promotion-receipt \ + "$RUNNER_TEMP/github-ci-upload/github-ci-upload-receipt.json" \ + "$RUNNER_TEMP/github-ci-deployment-create.json" \ + "$RUNNER_TEMP/github-ci-deployments.json" \ + "$RUNNER_TEMP/github-ci-promotion-receipt.json" + + - name: Publish the exact promotion receipt + uses: actions/upload-artifact@v7 + with: + name: ${{ steps.promotion-receipt.outputs.promotion_artifact_name }} + path: ${{ runner.temp }}/github-ci-promotion-receipt.json + if-no-files-found: error + retention-days: 30 diff --git a/.github/workflows/github-ci-worker-upload.yml b/.github/workflows/github-ci-worker-upload.yml new file mode 100644 index 0000000000..ce92206057 --- /dev/null +++ b/.github/workflows/github-ci-worker-upload.yml @@ -0,0 +1,281 @@ +name: github-ci Worker version upload + +# Manual, default-off upload. This creates an immutable Worker Version and +# never changes production traffic. Wrangler is used only by `cf build` to +# produce offline Build Output v1. +on: + workflow_dispatch: + inputs: + confirm_upload: + description: Set true to opt in to the protected, immutable upload + required: true + type: boolean + default: false + +permissions: + actions: read + contents: read + +concurrency: + group: github-ci-worker-upload + cancel-in-progress: false + +jobs: + check-upload-environment: + if: github.repository == 'developing-today/code' && github.ref == 'refs/heads/main' && inputs.confirm_upload == true + runs-on: ubuntu-24.04 + timeout-minutes: 5 + outputs: + environment_name: ${{ steps.verify.outputs.environment_name }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.sha }} + persist-credentials: false + + - name: Read upload environment and its only branch policy + id: policy + env: + GITHUB_TOKEN: ${{ github.token }} + ENVIRONMENT_NAME: github-ci-cloudflare-upload + run: | + set -euo pipefail + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME" \ + > "$RUNNER_TEMP/upload-environment.json" + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME/deployment-branch-policies" \ + > "$RUNNER_TEMP/upload-branch-policies.json" + node pkgs/github-ci/worker/scripts/deployment-guard.mjs select-branch-policy \ + "$RUNNER_TEMP/upload-branch-policies.json" + + - name: Verify upload environment protection + id: verify + env: + GITHUB_TOKEN: ${{ github.token }} + ENVIRONMENT_NAME: github-ci-cloudflare-upload + BRANCH_POLICY_ID: ${{ steps.policy.outputs.branch_policy_id }} + run: | + set -euo pipefail + [[ "$BRANCH_POLICY_ID" =~ ^[1-9][0-9]*$ ]] + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME/deployment-branch-policies/$BRANCH_POLICY_ID" \ + > "$RUNNER_TEMP/upload-branch-policy.json" + node pkgs/github-ci/worker/scripts/deployment-guard.mjs check-environment \ + "$RUNNER_TEMP/upload-environment.json" \ + "$RUNNER_TEMP/upload-branch-policy.json" \ + "$ENVIRONMENT_NAME" "$BRANCH_POLICY_ID" + + upload: + needs: check-upload-environment + if: github.repository == 'developing-today/code' && github.ref == 'refs/heads/main' && inputs.confirm_upload == true && needs.check-upload-environment.outputs.environment_name == 'github-ci-cloudflare-upload' + runs-on: ubuntu-24.04 + timeout-minutes: 25 + environment: + name: ${{ needs.check-upload-environment.outputs.environment_name }} + defaults: + run: + working-directory: .github/worker-deploy-ci + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.sha }} + persist-credentials: false + + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 24.22.0 + cache: npm + cache-dependency-path: | + pkgs/github-ci/worker/package-lock.json + .github/worker-deploy-ci/package-lock.json + + - name: Read upload environment and its only branch policy + id: policy + env: + GITHUB_TOKEN: ${{ github.token }} + ENVIRONMENT_NAME: ${{ needs.check-upload-environment.outputs.environment_name }} + run: | + set -euo pipefail + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME" \ + > "$RUNNER_TEMP/upload-environment.json" + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME/deployment-branch-policies" \ + > "$RUNNER_TEMP/upload-branch-policies.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs select-branch-policy \ + "$RUNNER_TEMP/upload-branch-policies.json" + + - name: Recheck upload environment protection before provider access + env: + GITHUB_TOKEN: ${{ github.token }} + ENVIRONMENT_NAME: ${{ needs.check-upload-environment.outputs.environment_name }} + BRANCH_POLICY_ID: ${{ steps.policy.outputs.branch_policy_id }} + run: | + set -euo pipefail + [[ "$BRANCH_POLICY_ID" =~ ^[1-9][0-9]*$ ]] + curl --fail --silent --show-error --max-time 15 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT_NAME/deployment-branch-policies/$BRANCH_POLICY_ID" \ + > "$RUNNER_TEMP/upload-branch-policy.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs check-environment \ + "$RUNNER_TEMP/upload-environment.json" \ + "$RUNNER_TEMP/upload-branch-policy.json" \ + "$ENVIRONMENT_NAME" "$BRANCH_POLICY_ID" + + - name: Install unchanged Worker package dependencies + working-directory: pkgs/github-ci/worker + run: npm ci --no-audit --no-fund + + - name: Typecheck the Worker + working-directory: pkgs/github-ci/worker + run: npm run typecheck + + - name: Install the isolated pinned cf toolchain + run: npm ci --ignore-scripts --no-audit --no-fund + + - name: Build Build Output v1 offline + env: + XDG_CONFIG_HOME: ${{ runner.temp }}/cf-config + WRANGLER_SEND_METRICS: "false" + run: npm run build + + - name: Verify Build Output and offline receipt guards + run: | + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs build .cloudflare/output/v1 + npm run test:offline + python3 ../../pkgs/github-ci/worker/test/deploy_workflows_test.py + + - name: Dry-run the prebuilt Versions request without Cloudflare credentials + env: + XDG_CONFIG_HOME: ${{ runner.temp }}/cf-config + WRANGLER_SEND_METRICS: "false" + run: >- + ./node_modules/.bin/cf -q workers versions create + --worker github-ci --tag offline-check --message offline-check + --prebuilt --dry-run + + - name: Validate Cloudflare credential presence + env: + CF_UPLOAD_ACCOUNT_ID: ${{ secrets.CF_UPLOAD_ACCOUNT_ID }} + CF_UPLOAD_API_TOKEN: ${{ secrets.CF_UPLOAD_API_TOKEN }} + run: | + set -euo pipefail + [[ "$CF_UPLOAD_ACCOUNT_ID" =~ ^[0-9a-fA-F]{32}$ ]] + [[ -n "$CF_UPLOAD_API_TOKEN" ]] + + - name: Require the existing Worker + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_UPLOAD_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_UPLOAD_API_TOKEN }} + run: ./node_modules/.bin/cf -q workers get github-ci >/dev/null + + - name: Select the current production baseline + id: select-baseline + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_UPLOAD_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_UPLOAD_API_TOKEN }} + run: | + set -euo pipefail + ./node_modules/.bin/cf workers deployments list --worker github-ci \ + > "$RUNNER_TEMP/github-ci-baseline-deployments.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs select-baseline \ + "$RUNNER_TEMP/github-ci-baseline-deployments.json" + + - name: Verify the active baseline retains every required secret binding + id: baseline + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_UPLOAD_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_UPLOAD_API_TOKEN }} + BASELINE_VERSION_ID: ${{ steps.select-baseline.outputs.baseline_version_id }} + run: | + set -euo pipefail + ./node_modules/.bin/cf workers versions get "$BASELINE_VERSION_ID" --worker github-ci \ + > "$RUNNER_TEMP/github-ci-baseline-version.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-baseline \ + "$RUNNER_TEMP/github-ci-baseline-deployments.json" \ + "$RUNNER_TEMP/github-ci-baseline-version.json" + + - name: Upload immutable Workers Version only + id: upload + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_UPLOAD_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_UPLOAD_API_TOKEN }} + run: | + set -euo pipefail + tag="git-${GITHUB_SHA:0:12}" + ./node_modules/.bin/cf workers versions list --worker github-ci --page 1 --per-page 1 \ + > "$RUNNER_TEMP/github-ci-versions-before-upload.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-inheritance-source \ + "$RUNNER_TEMP/github-ci-baseline-deployments.json" \ + "$RUNNER_TEMP/github-ci-versions-before-upload.json" + ./node_modules/.bin/cf workers versions create \ + --worker github-ci \ + --tag "$tag" \ + --message "github-ci candidate ${GITHUB_SHA}" \ + --prebuilt \ + > "$RUNNER_TEMP/github-ci-upload-create-response.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs select-upload-result \ + "$RUNNER_TEMP/github-ci-upload-create-response.json" + + - name: Read back exact candidate and verify retained binding names + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_UPLOAD_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CF_UPLOAD_API_TOKEN }} + VERSION_ID: ${{ steps.upload.outputs.version_id }} + run: | + set -euo pipefail + ./node_modules/.bin/cf workers versions get "$VERSION_ID" --worker github-ci \ + > "$RUNNER_TEMP/github-ci-candidate-version.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-version \ + "$RUNNER_TEMP/github-ci-candidate-version.json" "$VERSION_ID" "$GITHUB_SHA" + + - name: Require the candidate to be deployable + env: + CF_UPLOAD_ACCOUNT_ID: ${{ secrets.CF_UPLOAD_ACCOUNT_ID }} + CF_UPLOAD_API_TOKEN: ${{ secrets.CF_UPLOAD_API_TOKEN }} + VERSION_ID: ${{ steps.upload.outputs.version_id }} + run: | + set -euo pipefail + curl --fail --silent --show-error --max-time 15 \ + -H "Authorization: Bearer $CF_UPLOAD_API_TOKEN" \ + "https://api.cloudflare.com/client/v4/accounts/$CF_UPLOAD_ACCOUNT_ID/workers/scripts/github-ci/versions?deployable=true" \ + > "$RUNNER_TEMP/github-ci-deployable.json" + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs verify-deployable \ + "$RUNNER_TEMP/github-ci-deployable.json" "$VERSION_ID" + + - name: Create the exact upload receipt + id: receipt + run: | + set -euo pipefail + node ../../pkgs/github-ci/worker/scripts/deployment-guard.mjs write-upload-receipt \ + "$RUNNER_TEMP/github-ci-baseline-deployments.json" \ + "$RUNNER_TEMP/github-ci-baseline-version.json" \ + "$RUNNER_TEMP/github-ci-upload-create-response.json" \ + "$RUNNER_TEMP/github-ci-candidate-version.json" \ + "$RUNNER_TEMP/github-ci-upload-receipt.json" + + - name: Publish receipt for this exact run attempt + uses: actions/upload-artifact@v7 + with: + name: ${{ steps.receipt.outputs.artifact_name }} + path: ${{ runner.temp }}/github-ci-upload-receipt.json + if-no-files-found: error + retention-days: 30 diff --git a/.gitignore b/.gitignore index c204b3053c..2fdb4aa299 100755 --- a/.gitignore +++ b/.gitignore @@ -191,3 +191,5 @@ pm-stack/aggregator/events.json # dirty-tree refusal fire permanently (#5562). Root-anchored so only the # repo-root cache is ignored. /.cache/ + +.github/worker-deploy-ci/.cloudflare/ diff --git a/pkgs/github-ci/worker/README.md b/pkgs/github-ci/worker/README.md index 0323af90a6..8582b88242 100644 --- a/pkgs/github-ci/worker/README.md +++ b/pkgs/github-ci/worker/README.md @@ -68,9 +68,50 @@ broker's own agent token — the value in ```sh npm install npm test # vitest + @cloudflare/vitest-pool-workers -npm run deploy # wrangler deploy (fleet Cloudflare account) +npm run build # offline Build Output v1, delegated to Wrangler 4.166.0 +npm run test:deployment ``` +## GitHub Actions version flow + +`.github/workflows/github-ci-worker-upload.yml` and +`.github/workflows/github-ci-worker-promote.yml` are manual-only and +default off. Upload builds Build Output v1 with the isolated pinned +`cf` toolchain, then creates an immutable Workers Version with +`cf workers versions create --prebuilt`; it never changes production +traffic. Promotion requires the exact upload run ID and attempt, the +candidate Version UUID, and the baseline Deployment and Version UUIDs +from that upload receipt. It confirms the selected run succeeded on +`main`, the production baseline has not changed, and the newest +Cloudflare Deployment read-back serves the selected candidate at 100%. +The upload reads the exact Version UUID from the pinned `cf` create +response and binds it to the run-attempt receipt. Before creating a +candidate, it requires the latest uploaded Version to equal the currently +serving baseline; `cf` strict binding inheritance resolves against the +latest uploaded Version. Both workflows publish receipts with run, +attempt, source, candidate, baseline, and deployment identifiers. + +Each workflow first runs a detached read-only gate. It requires required +reviewers, self-review prevention, disabled administrator bypass, and +exactly one typed `branch:main` deployment policy. Only after that check +does the deployment job bind to the environment name emitted by the gate. +GitHub's published branch-policy read response documents only `id`, +`node_id`, and `name`; the gate requires `type: branch` and stops if GitHub +does not return that field. Resolve that API evidence gap before dispatching +either workflow. +Store `CF_UPLOAD_ACCOUNT_ID` and `CF_UPLOAD_API_TOKEN` only as environment +secrets in `github-ci-cloudflare-upload`; store +`CF_PROMOTION_ACCOUNT_ID` and `CF_PROMOTION_API_TOKEN` only as environment +secrets in `github-ci-production`. Use Cloudflare tokens scoped to the +`github-ci` Worker. The upload checks that the Worker already exists. It +also checks the active baseline and uploaded candidate for all six required +secret binding names. Receipt files contain binding names and types only; +secret values are never read or copied by these workflows. + +The existing operator `npm run deploy` command and Wrangler configuration +remain unchanged. This is the GitHub CI webhook Worker, not +`infra/github-backup`'s GitHub App backup receiver. + The cutover from the earlier Postgres receiver is complete (#5693, closeout below). diff --git a/pkgs/github-ci/worker/scripts/deployment-guard.mjs b/pkgs/github-ci/worker/scripts/deployment-guard.mjs new file mode 100644 index 0000000000..eb6cb6c52e --- /dev/null +++ b/pkgs/github-ci/worker/scripts/deployment-guard.mjs @@ -0,0 +1,559 @@ +#!/usr/bin/env node +import { appendFileSync, readFileSync, writeFileSync } from "node:fs"; +import { join } from "node:path"; +import { parseArgs } from "node:util"; + +const WORKER_NAME = "github-ci"; +const UPLOAD_WORKFLOW = ".github/workflows/github-ci-worker-upload.yml"; +const PROMOTE_WORKFLOW = ".github/workflows/github-ci-worker-promote.yml"; +const SECRET_BINDINGS = [ + "GITHUB_WEBHOOK_SECRET", + "TURSO_PLATFORM_TOKEN", + "TURSO_QUEUE_TOKEN", + "EVENTS_BROKER_TOKEN", + "EVENTS_BROKER_ACCESS_CLIENT_ID", + "EVENTS_BROKER_ACCESS_CLIENT_SECRET", +]; +const EXPECTED_TEXT_BINDINGS = { + TURSO_PLATFORM_URL: "https://fleet-platform-dezren39.aws-us-east-1.turso.io", + TURSO_QUEUE_URL: "https://fleet-queue-dezren39.aws-us-east-1.turso.io", + EVENTS_BROKER_URL: "https://queue-broker.security.cab", +}; + +const VERSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; +const COMMIT_SHA = /^[0-9a-f]{40}$/i; +const POSITIVE_INTEGER = /^[1-9][0-9]*$/; + +function usage() { + throw new Error( + "usage: deployment-guard.mjs build | select-branch-policy | check-environment | select-baseline | verify-baseline | verify-inheritance-source | select-upload-result | verify-version [commit-sha] | verify-deployable | write-upload-receipt | verify-upload-receipt | verify-baseline-current | verify-created-deployment | verify-promotion-readback | write-promotion-receipt ", + ); +} + +function readJson(path) { + try { + return JSON.parse(readFileSync(path, "utf8")); + } catch { + throw new Error(`could not read valid JSON from ${path}`); + } +} + +function unwrap(value) { + if (!value || typeof value !== "object" || Array.isArray(value)) return value; + if (value.success === false) throw new Error("API response was unsuccessful"); + return Object.hasOwn(value, "result") ? value.result : value; +} + +function rows(value, label) { + const result = unwrap(value); + if (Array.isArray(result)) return result; + if (result && typeof result === "object") { + if (Array.isArray(result.items)) return result.items; + if (Array.isArray(result.versions)) return result.versions; + if (Array.isArray(result.deployments)) return result.deployments; + } + throw new Error(`${label} response did not contain a list`); +} + +function createdOn(record, label) { + const value = record?.created_on ?? record?.metadata?.created_on; + const parsed = typeof value === "string" ? Date.parse(value) : Number.NaN; + if (!Number.isFinite(parsed)) throw new Error(`${label} is missing a valid created_on timestamp`); + return { value, parsed }; +} + +function newest(items, label) { + if (!items.length) throw new Error(`${label} response did not contain any records`); + const sorted = items + .map((item) => ({ item, ...createdOn(item, `${label} record`) })) + .sort((left, right) => right.parsed - left.parsed); + if (sorted.length > 1 && sorted[0].parsed === sorted[1].parsed && sorted[0].item.id !== sorted[1].item.id) { + throw new Error(`${label} response has ambiguous newest records`); + } + return sorted[0].item; +} + +function annotation(version, key) { + return version?.annotations?.[key] ?? version?.metadata?.annotations?.[key] ?? ""; +} + +function commitFrom(version) { + const tag = annotation(version, "workers/tag"); + const message = annotation(version, "workers/message"); + const match = /^github-ci candidate ([0-9a-f]{40})$/i.exec(message); + if (!match || tag !== `git-${match[1].slice(0, 12)}`) { + throw new Error("version provenance does not match a github-ci CI candidate commit"); + } + return match[1].toLowerCase(); +} + +function bindingsOf(version) { + const bindings = version?.bindings ?? version?.resources?.bindings; + if (Array.isArray(bindings)) return bindings; + const env = version?.env ?? version?.resources?.env; + if (env && typeof env === "object" && !Array.isArray(env)) { + return Object.entries(env).map(([name, value]) => ({ name, ...value })); + } + throw new Error("version response did not include its binding metadata"); +} + +function assertSecrets(version) { + const bindings = bindingsOf(version); + const missing = SECRET_BINDINGS.filter((name) => { + const matching = bindings.filter((binding) => binding.name === name); + return matching.length !== 1 || matching[0].type !== "secret_text"; + }); + if (missing.length) { + throw new Error(`version is missing required secret binding names or types: ${missing.join(", ")}`); + } + return [...SECRET_BINDINGS]; +} + +function reportOutput(values, summary) { + const outputPath = process.env.GITHUB_OUTPUT; + if (!outputPath) throw new Error("GITHUB_OUTPUT is not set"); + appendFileSync(outputPath, Object.entries(values).map(([key, value]) => `${key}=${value}\n`).join("")); + if (summary && process.env.GITHUB_STEP_SUMMARY) { + appendFileSync(process.env.GITHUB_STEP_SUMMARY, `${summary}\n`); + } +} + +function checkBuild(root) { + const rootConfig = readJson(join(root, "config.json")); + const worker = readJson(join(root, "workers/default/worker.config.json")); + if (rootConfig.producer?.name !== "wrangler" || rootConfig.producer?.version !== "4.166.0") { + throw new Error("Build Output must be produced by the pinned Wrangler 4.166.0 delegate"); + } + if (worker.name !== WORKER_NAME || worker.compatibilityDate !== "2025-09-15" || worker.workersDev !== true) { + throw new Error("Build Output worker identity, compatibility date, or workers.dev ingress differs from production"); + } + if (Object.hasOwn(worker, "previewUrls")) { + throw new Error("Build Output must preserve the existing preview URL policy without setting it"); + } + for (const [name, value] of Object.entries(EXPECTED_TEXT_BINDINGS)) { + const binding = worker.env?.[name]; + if (binding?.type !== "text" || binding.value !== value) { + throw new Error(`Build Output non-secret binding mismatch: ${name}`); + } + } + for (const name of SECRET_BINDINGS) { + const binding = worker.env?.[name]; + if (binding?.type !== "secret" || Object.hasOwn(binding, "value")) { + throw new Error(`Build Output must declare ${name} as a value-free secret binding`); + } + } + console.log("Build Output v1 has the expected Worker, ingress, production vars, and value-free secret declarations."); +} + +function selectBranchPolicy(path) { + const response = unwrap(readJson(path)); + const policies = response?.branch_policies; + if (!Array.isArray(policies) || policies.length !== 1 || response.total_count !== 1) { + throw new Error("environment must have exactly one deployment branch policy"); + } + const policy = policies[0]; + if (policy?.name !== "main" || !Number.isSafeInteger(policy.id) || policy.id < 1) { + throw new Error("environment must have one identified main deployment branch policy"); + } + reportOutput({ branch_policy_id: policy.id }, `Selected the only deployment policy ID for main (${policy.id}).`); +} + +function checkEnvironment(environmentPath, policyPath, expectedName, expectedPolicyId) { + const environment = readJson(environmentPath); + const policy = unwrap(readJson(policyPath)); + if (environment?.name !== expectedName) throw new Error(`required environment ${expectedName} is missing`); + const rules = environment.protection_rules; + const reviewerRules = Array.isArray(rules) ? rules.filter((rule) => rule.type === "required_reviewers") : []; + const reviewerRule = reviewerRules[0]; + const hasReviewer = Array.isArray(reviewerRule?.reviewers) && reviewerRule.reviewers.some((entry) => + ["User", "Team"].includes(entry?.type) && Number.isSafeInteger(entry?.reviewer?.id) && entry.reviewer.id > 0, + ); + if (reviewerRules.length !== 1 || !hasReviewer) throw new Error(`${expectedName} must have exactly one valid required-reviewer protection rule`); + if (reviewerRule.prevent_self_review !== true) throw new Error(`${expectedName} must prevent self-review`); + if (environment.can_admins_bypass !== false) throw new Error(`${expectedName} must disallow administrator bypass`); + const branchPolicy = environment.deployment_branch_policy; + if (branchPolicy?.protected_branches !== false || branchPolicy?.custom_branch_policies !== true) { + throw new Error(`${expectedName} must restrict deployments with a custom branch policy`); + } + if (!POSITIVE_INTEGER.test(String(expectedPolicyId)) || String(policy.id) !== String(expectedPolicyId) || policy.name !== "main" || policy.type !== "branch") { + throw new Error(`${expectedName} must have exactly the selected policy as type branch with name main`); + } + reportOutput( + { environment_name: expectedName }, + `Confirmed ${expectedName} has required reviewers, self-review prevention, no administrator bypass, and exactly the selected branch:main policy.`, + ); +} + +function deploymentRecord(path) { + const deployment = newest(rows(readJson(path), "deployment"), "deployment"); + if (!VERSION_ID.test(deployment.id ?? "")) throw new Error("latest deployment has no Cloudflare Deployment UUID"); + const versions = deployment.versions; + if (!Array.isArray(versions) || versions.length !== 1 || !VERSION_ID.test(versions[0]?.version_id ?? "") || Number(versions[0]?.percentage) !== 100) { + throw new Error("latest deployment must serve exactly one version at 100% traffic"); + } + const timestamp = createdOn(deployment, "latest deployment"); + return { + deployment_id: deployment.id, + version_id: versions[0].version_id, + created_on: timestamp.value, + created_at_ms: timestamp.parsed, + }; +} + +function versionRecord(path) { + const version = unwrap(readJson(path)); + if (!VERSION_ID.test(version?.id ?? "")) throw new Error("Worker Version response has no Cloudflare Version UUID"); + const timestamp = createdOn(version, "Worker Version"); + return { version, created_on: timestamp.value, created_at_ms: timestamp.parsed }; +} + +function verifyBaseline(deploymentsPath, versionPath) { + const baseline = deploymentRecord(deploymentsPath); + const version = versionRecord(versionPath); + if (version.version.id !== baseline.version_id) throw new Error("baseline version read-back does not match the active deployment"); + assertSecrets(version.version); + reportOutput( + { + baseline_deployment_id: baseline.deployment_id, + baseline_version_id: baseline.version_id, + baseline_created_on: baseline.created_on, + }, + `Verified active baseline deployment ${baseline.deployment_id}, version ${baseline.version_id}, and all ${SECRET_BINDINGS.length} secret binding names.`, + ); +} + +function verifyInheritanceSource(deploymentsPath, versionsPath) { + const baseline = deploymentRecord(deploymentsPath); + const versions = rows(readJson(versionsPath), "uploaded Worker Versions"); + if (versions.length !== 1) { + throw new Error("inheritance-source check must contain only the first latest Worker Version from page 1"); + } + const latestUploaded = versions[0]; + createdOn(latestUploaded, "latest uploaded Worker Version"); + if (!VERSION_ID.test(latestUploaded.id ?? "")) throw new Error("latest uploaded Worker Version has no Cloudflare Version UUID"); + if (latestUploaded.id !== baseline.version_id) { + throw new Error("latest uploaded Worker Version is not the currently serving production baseline; strict secret inheritance would use another version"); + } + console.log(`Latest uploaded Worker Version ${latestUploaded.id} matches serving baseline ${baseline.version_id}.`); +} + +function selectUploadResult(path) { + const response = unwrap(readJson(path)); + const versionId = response?.id; + if (!VERSION_ID.test(versionId ?? "")) throw new Error("cf Workers Version create response is missing its exact Version UUID"); + reportOutput({ version_id: versionId }, `Captured exact Workers Version UUID ${versionId} from the cf create response.`); +} + +function verifyVersion(path, requestedId, expectedSha) { + if (!VERSION_ID.test(requestedId)) throw new Error("requested version ID is not a UUID"); + const { version } = versionRecord(path); + if (version.id !== requestedId) throw new Error("Cloudflare returned a different Worker Version ID"); + const sha = commitFrom(version); + if (expectedSha !== undefined && sha !== expectedSha.toLowerCase()) { + throw new Error("version provenance does not match the requested source commit"); + } + assertSecrets(version); + reportOutput( + { source_sha: sha }, + `Verified candidate provenance ${sha} and all ${SECRET_BINDINGS.length} retained secret binding names for version ${requestedId}.`, + ); +} + +function verifyDeployable(path, requestedId) { + const versions = rows(readJson(path), "deployable versions"); + if (!versions.some((version) => version.id === requestedId)) { + throw new Error("requested Worker Version is not in Cloudflare's deployable set"); + } + console.log("Requested version is deployable."); +} + +function assertUploadRuntime() { + const sourceSha = (process.env.GITHUB_SHA ?? "").toLowerCase(); + if (process.env.GITHUB_REPOSITORY !== "developing-today/code") throw new Error("upload receipt must come from the production repository"); + if (process.env.GITHUB_EVENT_NAME !== "workflow_dispatch" || process.env.GITHUB_REF !== "refs/heads/main") { + throw new Error("upload receipt must come from a manual run on main"); + } + if (!COMMIT_SHA.test(sourceSha)) throw new Error("upload receipt is missing the full source commit SHA"); + const runId = process.env.GITHUB_RUN_ID ?? ""; + const attempt = process.env.GITHUB_RUN_ATTEMPT ?? ""; + if (!POSITIVE_INTEGER.test(runId) || !POSITIVE_INTEGER.test(attempt)) throw new Error("upload receipt is missing the exact run ID or attempt"); + const workflowRef = process.env.GITHUB_WORKFLOW_REF ?? ""; + if (!workflowRef.endsWith(`${UPLOAD_WORKFLOW}@refs/heads/main`)) throw new Error("upload receipt came from an unexpected workflow ref"); + return { sourceSha, runId, attempt: Number(attempt), workflowRef }; +} + +function writeUploadReceipt(baselineDeploymentsPath, baselineVersionPath, createResponsePath, candidatePath, outputPath) { + const runtime = assertUploadRuntime(); + const baseline = deploymentRecord(baselineDeploymentsPath); + const baselineVersion = versionRecord(baselineVersionPath); + if (baselineVersion.version.id !== baseline.version_id) throw new Error("baseline version read-back does not match the active deployment"); + assertSecrets(baselineVersion.version); + + const createResponse = unwrap(readJson(createResponsePath)); + if (!VERSION_ID.test(createResponse?.id ?? "")) throw new Error("cf Workers Version create response is missing its exact Version UUID"); + const candidateRecord = versionRecord(candidatePath); + const candidate = candidateRecord.version; + if (candidate.id !== createResponse.id) throw new Error("candidate read-back does not match the exact Version UUID returned by cf create"); + if (candidate.id === baseline.version_id) throw new Error("uploaded candidate is the same version as the baseline"); + if (candidateRecord.created_at_ms <= baseline.created_at_ms) throw new Error("uploaded candidate is not newer than its production baseline"); + const candidateSha = commitFrom(candidate); + if (candidateSha !== runtime.sourceSha) throw new Error("uploaded candidate provenance does not match this workflow commit"); + const candidateBindings = assertSecrets(candidate); + + const artifactName = `github-ci-candidate-${runtime.runId}-${runtime.attempt}`; + const receipt = { + schema: "github-ci-worker-upload-receipt/v1", + upload: { + repository: process.env.GITHUB_REPOSITORY, + workflow_path: UPLOAD_WORKFLOW, + workflow_ref: runtime.workflowRef, + event: process.env.GITHUB_EVENT_NAME, + ref: process.env.GITHUB_REF, + run_id: runtime.runId, + run_attempt: runtime.attempt, + source_sha: runtime.sourceSha, + artifact_name: artifactName, + }, + baseline: { + deployment_id: baseline.deployment_id, + version_id: baseline.version_id, + created_on: baseline.created_on, + }, + candidate: { + version_id: candidate.id, + created_on: candidateRecord.created_on, + tag: annotation(candidate, "workers/tag"), + message: annotation(candidate, "workers/message"), + secret_bindings: candidateBindings.map((name) => ({ name, type: "secret_text" })), + }, + }; + writeFileSync(outputPath, `${JSON.stringify(receipt, null, 2)}\n`, { flag: "wx" }); + reportOutput( + { version_id: candidate.id, artifact_name: artifactName, baseline_deployment_id: baseline.deployment_id, baseline_version_id: baseline.version_id }, + `Upload receipt ${artifactName} records attempt ${runtime.runId}/${runtime.attempt}, baseline deployment ${baseline.deployment_id}, baseline version ${baseline.version_id}, candidate version ${candidate.id}, and source ${runtime.sourceSha}.`, + ); +} + +function validateReceiptShape(receipt, expected) { + if (receipt?.schema !== "github-ci-worker-upload-receipt/v1") throw new Error("upload receipt schema is missing or unsupported"); + const upload = receipt.upload; + const baseline = receipt.baseline; + const candidate = receipt.candidate; + if (!upload || !baseline || !candidate) throw new Error("upload receipt is missing upload, baseline, or candidate records"); + if (upload.repository !== "developing-today/code" || upload.workflow_path !== UPLOAD_WORKFLOW || upload.event !== "workflow_dispatch" || upload.ref !== "refs/heads/main") { + throw new Error("upload receipt does not identify the approved upload workflow on main"); + } + if (String(upload.run_id) !== expected.runId || Number(upload.run_attempt) !== expected.attempt) { + throw new Error("upload receipt run ID or attempt does not match the selected upload run"); + } + if (upload.artifact_name !== `github-ci-candidate-${expected.runId}-${expected.attempt}`) { + throw new Error("upload receipt artifact name does not match the selected run attempt"); + } + if (!COMMIT_SHA.test(upload.source_sha ?? "")) throw new Error("upload receipt is missing a full source commit SHA"); + if (!VERSION_ID.test(candidate.version_id ?? "") || candidate.version_id !== expected.candidateVersionId) { + throw new Error("upload receipt candidate Version UUID does not match the requested version"); + } + if (!VERSION_ID.test(baseline.deployment_id ?? "") || baseline.deployment_id !== expected.baselineDeploymentId) { + throw new Error("upload receipt baseline Deployment UUID does not match the requested baseline"); + } + if (!VERSION_ID.test(baseline.version_id ?? "") || baseline.version_id !== expected.baselineVersionId) { + throw new Error("upload receipt baseline Version UUID does not match the requested baseline"); + } + if (baseline.version_id === candidate.version_id) throw new Error("upload receipt candidate and baseline versions are identical"); + const baselineTime = Date.parse(baseline.created_on ?? ""); + const candidateTime = Date.parse(candidate.created_on ?? ""); + if (!Number.isFinite(baselineTime) || !Number.isFinite(candidateTime) || candidateTime <= baselineTime) { + throw new Error("upload receipt is missing an ordered baseline/candidate timestamp"); + } + const expectedTag = `git-${upload.source_sha.slice(0, 12)}`; + const expectedMessage = `github-ci candidate ${upload.source_sha}`; + if (candidate.tag !== expectedTag || candidate.message !== expectedMessage) throw new Error("upload receipt candidate provenance does not match its source commit"); + const bindingNames = Array.isArray(candidate.secret_bindings) ? candidate.secret_bindings.map((binding) => binding.name) : []; + if (!Array.isArray(candidate.secret_bindings) || candidate.secret_bindings.length !== SECRET_BINDINGS.length || SECRET_BINDINGS.some((name) => bindingNames.filter((candidateName) => candidateName === name).length !== 1) || candidate.secret_bindings.some((binding) => binding.type !== "secret_text")) { + throw new Error("upload receipt is missing one or more required retained secret binding names"); + } + return { upload, baseline, candidate }; +} + +function verifyUploadRun(receiptPath, attemptPath, runIdArg, attemptArg, candidateIdArg, baselineDeploymentIdArg, baselineVersionIdArg) { + if (!POSITIVE_INTEGER.test(runIdArg) || !POSITIVE_INTEGER.test(attemptArg)) throw new Error("selected upload run ID and attempt must be positive integers"); + if (!VERSION_ID.test(candidateIdArg) || !VERSION_ID.test(baselineDeploymentIdArg) || !VERSION_ID.test(baselineVersionIdArg)) { + throw new Error("selected candidate and baseline receipt IDs must be Cloudflare UUIDs"); + } + const expected = { + runId: runIdArg, + attempt: Number(attemptArg), + candidateVersionId: candidateIdArg, + baselineDeploymentId: baselineDeploymentIdArg, + baselineVersionId: baselineVersionIdArg, + }; + const { upload, baseline, candidate } = validateReceiptShape(readJson(receiptPath), expected); + const run = readJson(attemptPath); + const workflowPath = (run.path ?? "").split("@")[0]; + const runId = String(run.run_id ?? run.id ?? ""); + if (runId !== expected.runId || Number(run.run_attempt) !== expected.attempt) throw new Error("GitHub returned a different workflow run attempt"); + if (workflowPath !== UPLOAD_WORKFLOW) throw new Error("selected run attempt is not the github-ci Worker upload workflow"); + if (run.event !== "workflow_dispatch" || run.head_branch !== "main" || run.status !== "completed" || run.conclusion !== "success") { + throw new Error("selected upload run attempt is not a successful manual run on main"); + } + if (run.head_sha?.toLowerCase() !== upload.source_sha) throw new Error("upload receipt source commit does not match the selected run attempt"); + if (run.repository?.full_name !== upload.repository) throw new Error("selected upload run belongs to a different repository"); + reportOutput( + { + source_sha: upload.source_sha, + candidate_version_id: candidate.version_id, + baseline_deployment_id: baseline.deployment_id, + baseline_version_id: baseline.version_id, + }, + `Validated upload receipt from run attempt ${expected.runId}/${expected.attempt} with baseline deployment ${baseline.deployment_id} and candidate version ${candidate.version_id}.`, + ); +} + +function verifyBaselineCurrent(deploymentsPath, receiptPath) { + const candidateReceipt = readJson(receiptPath); + const receipt = validateReceiptShape(candidateReceipt, { + runId: String(candidateReceipt.upload?.run_id ?? ""), + attempt: Number(candidateReceipt.upload?.run_attempt ?? 0), + candidateVersionId: candidateReceipt.candidate?.version_id ?? "", + baselineDeploymentId: candidateReceipt.baseline?.deployment_id ?? "", + baselineVersionId: candidateReceipt.baseline?.version_id ?? "", + }); + const current = deploymentRecord(deploymentsPath); + if (current.deployment_id !== receipt.baseline.deployment_id || current.version_id !== receipt.baseline.version_id || current.created_on !== receipt.baseline.created_on) { + throw new Error("production baseline changed after the upload receipt was created"); + } + console.log(`Current production baseline matches receipt ${current.deployment_id}/${current.version_id}.`); +} + +function createdDeployment(path, receipt) { + const response = unwrap(readJson(path)); + const deployment = response?.deployment ?? response; + if (!VERSION_ID.test(deployment?.id ?? "")) throw new Error("deployment create response is missing its exact Deployment UUID"); + const versions = deployment.versions; + if (!Array.isArray(versions) || versions.length !== 1 || versions[0]?.version_id !== receipt.candidate.version_id || Number(versions[0]?.percentage) !== 100) { + throw new Error("deployment create response does not contain the receipted candidate at 100% traffic"); + } + if (deployment.id === receipt.baseline.deployment_id) throw new Error("deployment create response reused the baseline Deployment UUID"); + const timestamp = createdOn(deployment, "created deployment"); + if (timestamp.parsed <= Date.parse(receipt.baseline.created_on)) throw new Error("created deployment is not newer than its receipted baseline"); + return { id: deployment.id, created_on: timestamp.value }; +} + +function promotionReadback(deploymentsPath, receiptPath, createdPath) { + const candidateReceipt = readJson(receiptPath); + const receipt = validateReceiptShape(candidateReceipt, { + runId: String(candidateReceipt.upload?.run_id ?? ""), + attempt: Number(candidateReceipt.upload?.run_attempt ?? 0), + candidateVersionId: candidateReceipt.candidate?.version_id ?? "", + baselineDeploymentId: candidateReceipt.baseline?.deployment_id ?? "", + baselineVersionId: candidateReceipt.baseline?.version_id ?? "", + }); + const created = createdDeployment(createdPath, receipt); + const actual = deploymentRecord(deploymentsPath); + if (actual.deployment_id !== created.id) throw new Error("latest deployment read-back does not match the exact deployment create receipt"); + if (actual.created_on !== created.created_on) throw new Error("latest deployment timestamp does not match the exact deployment create receipt"); + if (actual.version_id !== receipt.candidate.version_id || actual.created_at_ms <= Date.parse(receipt.baseline.created_on)) { + throw new Error("latest deployment read-back does not promote the receipted candidate over its baseline"); + } + return { receipt, created, actual }; +} + +function verifyCreatedDeployment(createdPath, receiptPath) { + const candidateReceipt = readJson(receiptPath); + const receipt = validateReceiptShape(candidateReceipt, { + runId: String(candidateReceipt.upload?.run_id ?? ""), + attempt: Number(candidateReceipt.upload?.run_attempt ?? 0), + candidateVersionId: candidateReceipt.candidate?.version_id ?? "", + baselineDeploymentId: candidateReceipt.baseline?.deployment_id ?? "", + baselineVersionId: candidateReceipt.baseline?.version_id ?? "", + }); + const created = createdDeployment(createdPath, receipt); + reportOutput( + { deployment_id: created.id }, + `Cloudflare created deployment ${created.id} for receipted candidate ${receipt.candidate.version_id}.`, + ); +} + +function verifyPromotionReadback(deploymentsPath, receiptPath, createdPath) { + const { receipt, created } = promotionReadback(deploymentsPath, receiptPath, createdPath); + reportOutput( + { deployment_id: created.id }, + `Read-back confirms new deployment ${created.id} promotes candidate ${receipt.candidate.version_id} at 100% over baseline ${receipt.baseline.deployment_id}.`, + ); +} + +function writePromotionReceipt(receiptPath, createdPath, deploymentsPath, outputPath) { + const { receipt, created } = promotionReadback(deploymentsPath, receiptPath, createdPath); + const runId = process.env.GITHUB_RUN_ID ?? ""; + const attempt = process.env.GITHUB_RUN_ATTEMPT ?? ""; + const workflowRef = process.env.GITHUB_WORKFLOW_REF ?? ""; + if (process.env.GITHUB_REPOSITORY !== receipt.upload.repository || process.env.GITHUB_EVENT_NAME !== "workflow_dispatch" || process.env.GITHUB_REF !== "refs/heads/main") { + throw new Error("promotion receipt must come from a manual run on main in the upload repository"); + } + if (!POSITIVE_INTEGER.test(runId) || !POSITIVE_INTEGER.test(attempt) || !workflowRef.endsWith(`${PROMOTE_WORKFLOW}@refs/heads/main`)) { + throw new Error("promotion receipt is missing its exact workflow run identity"); + } + const promotionReceipt = { + schema: "github-ci-worker-promotion-receipt/v1", + upload: receipt.upload, + baseline: receipt.baseline, + candidate: receipt.candidate, + promotion: { + repository: process.env.GITHUB_REPOSITORY, + workflow_path: PROMOTE_WORKFLOW, + workflow_ref: workflowRef, + event: process.env.GITHUB_EVENT_NAME, + ref: process.env.GITHUB_REF, + run_id: runId, + run_attempt: Number(attempt), + source_sha: receipt.upload.source_sha, + }, + deployment: { + id: created.id, + created_on: created.created_on, + version_id: receipt.candidate.version_id, + percentage: 100, + }, + }; + writeFileSync(outputPath, `${JSON.stringify(promotionReceipt, null, 2)}\n`, { flag: "wx" }); + const artifactName = `github-ci-promotion-${runId}-${attempt}`; + reportOutput( + { promotion_artifact_name: artifactName }, + `Promotion receipt ${artifactName} records upload attempt ${receipt.upload.run_id}/${receipt.upload.run_attempt}, baseline deployment ${receipt.baseline.deployment_id}, and deployment ${created.id} at 100%.`, + ); +} + +function main() { + const parsed = parseArgs({ args: process.argv.slice(2), options: {}, allowPositionals: true, strict: true }); + const [command, ...args] = parsed.positionals; + if (command === "build" && args.length === 1) return checkBuild(args[0]); + if (command === "select-branch-policy" && args.length === 1) return selectBranchPolicy(args[0]); + if (command === "check-environment" && args.length === 4) return checkEnvironment(args[0], args[1], args[2], args[3]); + if (command === "select-upload-result" && args.length === 1) return selectUploadResult(args[0]); + if (command === "select-baseline" && args.length === 1) { + const baseline = deploymentRecord(args[0]); + reportOutput( + { baseline_deployment_id: baseline.deployment_id, baseline_version_id: baseline.version_id, baseline_created_on: baseline.created_on }, + `Selected active baseline deployment ${baseline.deployment_id} and version ${baseline.version_id}.`, + ); + return; + } + if (command === "verify-baseline" && args.length === 2) return verifyBaseline(args[0], args[1]); + if (command === "verify-inheritance-source" && args.length === 2) return verifyInheritanceSource(args[0], args[1]); + if (command === "verify-version" && (args.length === 2 || args.length === 3)) return verifyVersion(args[0], args[1], args[2]); + if (command === "verify-deployable" && args.length === 2) return verifyDeployable(args[0], args[1]); + if (command === "write-upload-receipt" && args.length === 5) return writeUploadReceipt(args[0], args[1], args[2], args[3], args[4]); + if (command === "verify-upload-receipt" && args.length === 7) return verifyUploadRun(...args); + if (command === "verify-baseline-current" && args.length === 2) return verifyBaselineCurrent(args[0], args[1]); + if (command === "verify-created-deployment" && args.length === 2) return verifyCreatedDeployment(args[0], args[1]); + if (command === "verify-promotion-readback" && args.length === 3) return verifyPromotionReadback(args[0], args[1], args[2]); + if (command === "write-promotion-receipt" && args.length === 4) return writePromotionReceipt(args[0], args[1], args[2], args[3]); + usage(); +} + +try { + main(); +} catch (error) { + console.error(`deployment guard: ${error instanceof Error ? error.message : String(error)}`); + process.exitCode = 2; +} diff --git a/pkgs/github-ci/worker/test/deploy_workflows_test.py b/pkgs/github-ci/worker/test/deploy_workflows_test.py new file mode 100644 index 0000000000..4f91de6b78 --- /dev/null +++ b/pkgs/github-ci/worker/test/deploy_workflows_test.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +"""Offline guard checks for github-ci Worker deployment workflows.""" + +import json +from pathlib import Path +import unittest + + +REPO_ROOT = Path(__file__).resolve().parents[4] +UPLOAD = (REPO_ROOT / ".github/workflows/github-ci-worker-upload.yml").read_text() +PROMOTE = (REPO_ROOT / ".github/workflows/github-ci-worker-promote.yml").read_text() +TOOLCHAIN = json.loads((REPO_ROOT / ".github/worker-deploy-ci/package.json").read_text()) +WORKER_PACKAGE = json.loads((REPO_ROOT / "pkgs/github-ci/worker/package.json").read_text()) + + +class DeploymentWorkflowTests(unittest.TestCase): + def test_upload_is_manual_default_off_cf_only_and_never_promotes(self): + self.assertIn("workflow_dispatch:", UPLOAD) + self.assertIn("default: false", UPLOAD) + self.assertNotIn("push:", UPLOAD) + self.assertIn("inputs.confirm_upload == true", UPLOAD) + self.assertIn("name: ${{ needs.check-upload-environment.outputs.environment_name }}", UPLOAD) + self.assertNotIn("environment: github-ci-cloudflare-upload", UPLOAD) + self.assertIn("steps.verify.outputs.environment_name", UPLOAD) + self.assertIn("check-environment", UPLOAD) + self.assertIn("select-branch-policy", UPLOAD) + self.assertIn("deployment-branch-policies/$BRANCH_POLICY_ID", UPLOAD) + self.assertIn("node-version: 24.22.0", UPLOAD) + self.assertIn("npm run build", UPLOAD) + self.assertIn("cf workers versions create", UPLOAD) + self.assertIn("--prebuilt --dry-run", UPLOAD) + self.assertIn("workers versions list --worker github-ci --page 1 --per-page 1", UPLOAD) + self.assertIn("verify-inheritance-source", UPLOAD) + self.assertIn("select-upload-result", UPLOAD) + self.assertIn("github-ci-upload-create-response.json", UPLOAD) + self.assertLess(UPLOAD.index("verify-inheritance-source"), UPLOAD.index("cf workers versions create")) + self.assertLess(UPLOAD.index("cf workers versions create"), UPLOAD.index("select-upload-result")) + self.assertNotIn("select-upload \\", UPLOAD) + self.assertIn("versions get", UPLOAD) + self.assertIn("select-baseline", UPLOAD) + self.assertIn("verify-baseline", UPLOAD) + self.assertIn("verify-version", UPLOAD) + self.assertIn("verify-deployable", UPLOAD) + self.assertIn("write-upload-receipt", UPLOAD) + self.assertIn("actions/upload-artifact@v7", UPLOAD) + self.assertNotIn("cf workers deployments create", UPLOAD) + self.assertNotRegex(UPLOAD, r"(?m)^\s*(?:npx\s+)?(?:\./node_modules/\.bin/)?wrangler(?:\s|$)") + self.assertNotIn("--secrets-file", UPLOAD) + self.assertIn("GITHUB_TOKEN: ${{ github.token }}", UPLOAD) + self.assertIn("secrets.CF_UPLOAD_ACCOUNT_ID", UPLOAD) + self.assertIn("secrets.CF_UPLOAD_API_TOKEN", UPLOAD) + self.assertNotIn("secrets.CF_PROMOTION_", UPLOAD) + self.assertNotIn("secrets.CF_ACCOUNT_ID", UPLOAD) + self.assertNotIn("secrets.CF_API_TOKEN", UPLOAD) + for runtime_secret in [ + "GITHUB_WEBHOOK_SECRET", + "TURSO_PLATFORM_TOKEN", + "TURSO_QUEUE_TOKEN", + "EVENTS_BROKER_TOKEN", + "EVENTS_BROKER_ACCESS_CLIENT_ID", + "EVENTS_BROKER_ACCESS_CLIENT_SECRET", + ]: + self.assertNotIn(runtime_secret, UPLOAD) + self.assertNotIn(runtime_secret, PROMOTE) + + def test_promotion_requires_exact_upload_attempt_and_readback_receipts(self): + self.assertIn("workflow_dispatch:", PROMOTE) + self.assertIn("default: false", PROMOTE) + self.assertNotIn("push:", PROMOTE) + self.assertIn("inputs.confirm_promotion == true", PROMOTE) + self.assertIn("name: ${{ needs.check-production-environment.outputs.environment_name }}", PROMOTE) + self.assertNotIn("environment: github-ci-production", PROMOTE) + self.assertIn("steps.verify.outputs.environment_name", PROMOTE) + self.assertIn("check-environment", PROMOTE) + self.assertIn("select-branch-policy", PROMOTE) + self.assertIn("deployment-branch-policies/$BRANCH_POLICY_ID", PROMOTE) + for receipt_input in ("upload_run_id:", "upload_run_attempt:", "version_id:", "baseline_deployment_id:", "baseline_version_id:"): + self.assertIn(receipt_input, PROMOTE) + self.assertIn("actions/download-artifact@v8", PROMOTE) + self.assertIn("actions/runs/$UPLOAD_RUN_ID/attempts/$UPLOAD_RUN_ATTEMPT", PROMOTE) + self.assertIn("verify-upload-receipt", PROMOTE) + self.assertIn("cf workers versions get", PROMOTE) + self.assertIn("verify-baseline-current", PROMOTE) + self.assertIn("git merge-base --is-ancestor", PROMOTE) + self.assertIn("cf workers deployments create", PROMOTE) + self.assertIn("cf workers deployments list", PROMOTE) + self.assertIn("verify-promotion-readback", PROMOTE) + self.assertIn("write-promotion-receipt", PROMOTE) + self.assertIn("secrets.CF_PROMOTION_ACCOUNT_ID", PROMOTE) + self.assertIn("secrets.CF_PROMOTION_API_TOKEN", PROMOTE) + self.assertNotIn("secrets.CF_UPLOAD_", PROMOTE) + self.assertNotIn("secrets.CF_ACCOUNT_ID", PROMOTE) + self.assertNotIn("secrets.CF_API_TOKEN", PROMOTE) + self.assertIn("actions/upload-artifact@v7", PROMOTE) + self.assertNotIn("wrangler deploy", PROMOTE) + self.assertNotRegex(PROMOTE, r"(?m)^\s*(?:npx\s+)?(?:\./node_modules/\.bin/)?wrangler(?:\s|$)") + + def test_pinned_toolchain_is_separate_from_operator_package(self): + self.assertEqual(TOOLCHAIN["engines"]["node"], "24.22.0") + self.assertEqual(TOOLCHAIN["devDependencies"]["cf"], "1.0.0-rc.1") + self.assertEqual(TOOLCHAIN["devDependencies"]["wrangler"], "4.166.0") + self.assertEqual(WORKER_PACKAGE["scripts"]["deploy"], "wrangler deploy") + self.assertEqual(WORKER_PACKAGE["devDependencies"]["wrangler"], "4.59.1") + self.assertNotIn("cf", WORKER_PACKAGE["devDependencies"]) + + +if __name__ == "__main__": + unittest.main()