From d94a5a58a4558e202785395a0a7e33516f4de86a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 23 Sep 2026 11:26:02 +0000 Subject: [PATCH 1/4] wip(deploy-cloudflare): action, Access gate probe and pinned wrangler (#163) Work in progress, not yet ready for review. In this commit: - deploy-cloudflare/action.yml: validates inputs, checks the Access gate before uploading (refuses a missing, public or wrongly gated Worker), sets up Node only if <22, installs wrangler with npm ci from the committed lockfile, writes a wrangler.jsonc into RUNNER_TEMP, deploys, checks the gate after the deploy (root + one non-HTML asset), uploads and checks an optional preview alias, and writes a job summary. - deploy-cloudflare/package.json + package-lock.json: wrangler 4.136.3. - scripts/check-access-gate.sh: the pilot's probe, generalised to several URLs; exact team-domain match, loud failure on 2xx, no -L. - .github/fixtures/access-gate/server.py: local stand-in for each gate response shape, for the harness. Still to do: harness jobs, README/CHANGELOG/TESTING/dependabot docs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JxLZgJNNxNmNmeUUiD3SBW --- .github/fixtures/access-gate/server.py | 57 + deploy-cloudflare/action.yml | 377 ++++++ deploy-cloudflare/package-lock.json | 1452 ++++++++++++++++++++++++ deploy-cloudflare/package.json | 9 + scripts/check-access-gate.sh | 84 ++ 5 files changed, 1979 insertions(+) create mode 100644 .github/fixtures/access-gate/server.py create mode 100644 deploy-cloudflare/action.yml create mode 100644 deploy-cloudflare/package-lock.json create mode 100644 deploy-cloudflare/package.json create mode 100755 scripts/check-access-gate.sh diff --git a/.github/fixtures/access-gate/server.py b/.github/fixtures/access-gate/server.py new file mode 100644 index 0000000..6de2194 --- /dev/null +++ b/.github/fixtures/access-gate/server.py @@ -0,0 +1,57 @@ +"""Local stand-in for a Cloudflare Access gate, for the check-access-gate.sh harness job. + +Each path answers the way one real configuration would, so the probe can be run +against every shape it must tell apart without a Cloudflare account: + + /gated/... 302 to the team's login domain (a correctly gated Worker) + /wrong-org/... 302 to a different *.cloudflareaccess.com (wrong Access org) + /public/... 200 with content (the alarm case: the site is public) + /same-host/... 307 back to this host (asset html_handling, not Access) + /no-location 302 with no Location header + /missing 404 (no Worker on this hostname) + /broken 500 (retried by the probe, then fails) + /mixed-case 302 to the team domain in mixed case with an explicit :443 + +Usage: python3 server.py +""" + +import sys +from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer + +TEAM = "https://quantecon-harness.cloudflareaccess.com" + + +class Handler(BaseHTTPRequestHandler): + def do_GET(self): + path = self.path + if path.startswith("/gated"): + self.reply(302, {"Location": f"{TEAM}/cdn-cgi/access/login/site?redirect_url={path}"}) + elif path.startswith("/wrong-org"): + self.reply(302, {"Location": "https://someone-else.cloudflareaccess.com/cdn-cgi/access/login/site"}) + elif path.startswith("/public"): + self.reply(200, {"Content-Type": "text/html"}, b"

private report

") + elif path.startswith("/same-host"): + self.reply(307, {"Location": "/public/"}) + elif path == "/no-location": + self.reply(302, {}) + elif path == "/broken": + self.reply(500, {}) + elif path == "/mixed-case": + self.reply(302, {"Location": "https://QuantEcon-Harness.CloudflareAccess.com:443/cdn-cgi/access/login/site"}) + else: + self.reply(404, {}) + + def reply(self, code, headers, body=b""): + self.send_response(code) + for name, value in headers.items(): + self.send_header(name, value) + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def log_message(self, fmt, *args): + sys.stderr.write("server: " + (fmt % args) + "\n") + + +if __name__ == "__main__": + ThreadingHTTPServer(("127.0.0.1", int(sys.argv[1])), Handler).serve_forever() diff --git a/deploy-cloudflare/action.yml b/deploy-cloudflare/action.yml new file mode 100644 index 0000000..ef4ac26 --- /dev/null +++ b/deploy-cloudflare/action.yml @@ -0,0 +1,377 @@ +name: 'Deploy Cloudflare' +description: 'Publishes a built site to an existing Cloudflare Worker behind Cloudflare Access, and fails unless the site is proven gated before and after the deploy' +author: 'QuantEcon' + +inputs: + cloudflare-api-token: + description: >- + Cloudflare API token (use secrets.CLOUDFLARE_API_TOKEN). Account-owned, + with Editor on the named Worker only: it can deploy that Worker but + cannot create one, so a mistyped worker-name fails instead of creating a + new, ungated Worker. + required: true + cloudflare-account-id: + description: 'Cloudflare account ID (use secrets.CLOUDFLARE_ACCOUNT_ID)' + required: true + worker-name: + description: >- + The Worker to deploy to, one per site. It must already exist and already + be behind Access; see the README setup checklist. + required: true + account-subdomain: + description: >- + The account's workers.dev subdomain, e.g. `quantecon` for + `*.quantecon.workers.dev`. The URLs are constructed from it, never parsed + from wrangler output. + required: true + team-domain: + description: >- + The Access team's login domain, `.cloudflareaccess.com` (a bare + `` is accepted). The gate check requires the redirect to land on + exactly this host. + required: true + build-dir: + description: 'Directory containing the built site' + required: true + alias: + description: >- + Also upload the same build as a named preview alias, e.g. `report-2026-08`, + for a permanent URL alongside the moving production one. Lowercase + letters, digits and dashes, starting with a letter; `-` + must fit in 63 characters. Empty for none. + required: false + default: '' + require-access: + description: >- + Prove the site is gated: before uploading, and again after, an + unauthenticated request must be redirected to team-domain. `false` skips + both checks and should never be used for private content. + required: false + default: 'true' + +outputs: + deploy-url: + description: 'Production URL, https://{worker}.{subdomain}.workers.dev. Set once the deploy succeeds.' + value: ${{ steps.deploy.outputs.deploy-url }} + alias-url: + description: 'Preview alias URL, https://{alias}-{worker}.{subdomain}.workers.dev. Empty when no alias is given.' + value: ${{ steps.alias.outputs.alias-url }} + +runs: + using: "composite" + steps: + - name: Validate inputs + id: inputs + shell: bash + env: + API_TOKEN: ${{ inputs.cloudflare-api-token }} + ACCOUNT_ID: ${{ inputs.cloudflare-account-id }} + WORKER_NAME: ${{ inputs.worker-name }} + ACCOUNT_SUBDOMAIN: ${{ inputs.account-subdomain }} + TEAM_DOMAIN: ${{ inputs.team-domain }} + BUILD_DIR: ${{ inputs.build-dir }} + ALIAS: ${{ inputs.alias }} + REQUIRE_ACCESS: ${{ inputs.require-access }} + run: | + set -euo pipefail + fail() { echo "::error::$1"; exit 1; } + label='^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$' + + # Secrets are empty, not absent, on fork and Dependabot runs. + [ -n "$API_TOKEN" ] || fail "cloudflare-api-token is empty. Secrets are not passed to workflows triggered from forks or by Dependabot." + [ -n "$ACCOUNT_ID" ] || fail "cloudflare-account-id is empty." + + [[ "$WORKER_NAME" =~ $label ]] \ + || fail "worker-name [$WORKER_NAME] is not a valid workers.dev hostname label (lowercase letters, digits and dashes, at most 63 characters)." + + subdomain=$(printf '%s' "$ACCOUNT_SUBDOMAIN" | tr '[:upper:]' '[:lower:]') + subdomain=${subdomain#https://}; subdomain=${subdomain%/}; subdomain=${subdomain%.workers.dev} + [[ "$subdomain" =~ $label ]] \ + || fail "account-subdomain [$ACCOUNT_SUBDOMAIN] is not a workers.dev subdomain; pass the part before .workers.dev." + + team=$(printf '%s' "$TEAM_DOMAIN" | tr '[:upper:]' '[:lower:]') + team=${team#https://}; team=${team%/} + [[ "$team" == *.* ]] || team="$team.cloudflareaccess.com" + [[ "$team" =~ ^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.cloudflareaccess\.com$ ]] \ + || fail "team-domain [$TEAM_DOMAIN] is not an Access login domain (.cloudflareaccess.com)." + + if [ -n "$ALIAS" ]; then + # Cloudflare's rule; wrangler does not check it before uploading. + [[ "$ALIAS" =~ ^[a-z]([a-z0-9-]*[a-z0-9])?$ ]] \ + || fail "alias [$ALIAS] must be lowercase letters, digits and dashes, start with a letter and not end with a dash (e.g. report-2026-08, not 2026-08)." + [ $(( ${#ALIAS} + 1 + ${#WORKER_NAME} )) -le 63 ] \ + || fail "alias [$ALIAS] is too long: [$ALIAS-$WORKER_NAME] must fit in one 63-character hostname label." + fi + + case "$REQUIRE_ACCESS" in + true|false) ;; + *) fail "require-access must be 'true' or 'false', got [$REQUIRE_ACCESS]." ;; + esac + + [ -d "$BUILD_DIR" ] || fail "build-dir [$BUILD_DIR] is not a directory." + BUILD_DIR=$(cd "$BUILD_DIR" && pwd -P) + [ -n "$(find "$BUILD_DIR" -type f -print -quit)" ] || fail "build-dir [$BUILD_DIR] contains no files." + [ -f "$BUILD_DIR/index.html" ] || echo "::warning::build-dir has no index.html, so the site root will answer 404 once past the Access login." + + # One real non-HTML file to probe besides the root, so a gate that + # covers only the document root cannot pass (the pilot's + # data/latest.json check). Deterministic, URL-safe paths only, so no + # encoding is needed; dotfiles and wrangler's own control files are + # skipped because they are never served. `awk` reads to the end rather + # than exiting early, which under pipefail would fail on sort's SIGPIPE. + probe_path=$(cd "$BUILD_DIR" && find . -type f ! -path '*/.*' ! -iname '*.html' ! -iname '*.htm' \ + ! -name '_headers' ! -name '_redirects' ! -name '_worker.js' -print \ + | LC_ALL=C sort \ + | awk '!found && /^\.\/[A-Za-z0-9._~\/-]+$/ { print substr($0, 2); found = 1 }' || true) + + deploy_url="https://${WORKER_NAME}.${subdomain}.workers.dev" + alias_url="" + [ -z "$ALIAS" ] || alias_url="https://${ALIAS}-${WORKER_NAME}.${subdomain}.workers.dev" + + { + echo "team-domain=$team" + echo "build-dir=$BUILD_DIR" + echo "probe-path=$probe_path" + echo "deploy-url=$deploy_url" + echo "alias-url=$alias_url" + } >> "$GITHUB_OUTPUT" + + echo "Worker: $WORKER_NAME" + echo "Production: $deploy_url" + [ -z "$alias_url" ] || echo "Alias: $alias_url" + echo "Access team: $team" + echo "Probe paths: / ${probe_path:-(no non-HTML file in build-dir)}" + + # Prevention, not detection. Before anything is uploaded, the Worker must + # already answer an anonymous request with a redirect to this team's login. + # That refuses a Worker that does not exist (a mistyped name, which a + # broader token than the README's would otherwise create, ungated), one + # that is public, and one gated by the wrong Access organisation. + - name: Check the Access gate before deploying + id: gate-before + if: inputs.require-access == 'true' + shell: bash + env: + TEAM: ${{ steps.inputs.outputs.team-domain }} + URL: ${{ steps.inputs.outputs.deploy-url }} + PROBE_PATH: ${{ steps.inputs.outputs.probe-path }} + run: | + set -uo pipefail + urls=("$URL/") + [ -z "$PROBE_PATH" ] || urls+=("$URL$PROBE_PATH") + if ! bash "$GITHUB_ACTION_PATH/../scripts/check-access-gate.sh" "$TEAM" "${urls[@]}"; then + echo "::error::Refusing to deploy: $URL is not behind Access for $TEAM. Nothing was uploaded. An admin must create the Worker and turn Access on (All traffic) before its first deploy; see the deploy-cloudflare README setup checklist." + exit 1 + fi + + - name: Warn that the gate is not checked + if: inputs.require-access != 'true' + shell: bash + run: echo "::warning::require-access is false, so this deploy does not check that the site is behind Access. Never use this for private content." + + - name: Check for Node.js 22 or later + id: node + shell: bash + run: | + major=0 + if command -v node >/dev/null 2>&1; then + v=$(node --version); major=${v#v}; major=${major%%.*} + echo "Found node $v" + fi + # wrangler refuses to run below 22. The QuantEcon images carry 24. + if [ "$major" -ge 22 ] 2>/dev/null; then + echo "ok=true" >> "$GITHUB_OUTPUT" + else + echo "ok=false" >> "$GITHUB_OUTPUT" + echo "Node.js 22+ not found; installing 24" + fi + + - name: Set up Node.js + if: steps.node.outputs.ok != 'true' + uses: actions/setup-node@v7 + with: + node-version: '24' + package-manager-cache: false + + # Exact version from the committed lockfile, integrity-checked across the + # whole dependency tree; Dependabot proposes bumps (#105). Installed outside + # the workspace so nothing lands in the consumer's checkout. + - name: Install wrangler + id: wrangler + shell: bash + run: | + set -euo pipefail + dir="$RUNNER_TEMP/deploy-cloudflare" + mkdir -p "$dir" + cp "$GITHUB_ACTION_PATH/package.json" "$GITHUB_ACTION_PATH/package-lock.json" "$dir/" + npm ci --prefix "$dir" --no-audit --no-fund + "$dir/node_modules/.bin/wrangler" --version + echo "bin=$dir/node_modules/.bin/wrangler" >> "$GITHUB_OUTPUT" + echo "dir=$dir" >> "$GITHUB_OUTPUT" + + # Generated per run, not committed per repo. Paths in a wrangler config + # resolve against the config file, so the assets directory is absolute. + - name: Write the Worker config + id: config + shell: bash + env: + CONFIG: ${{ steps.wrangler.outputs.dir }}/${{ inputs.worker-name }}.wrangler.jsonc + WORKER_NAME: ${{ inputs.worker-name }} + BUILD_DIR: ${{ steps.inputs.outputs.build-dir }} + run: | + set -euo pipefail + node -e ' + const fs = require("fs"); + const [file, name, directory] = process.argv.slice(1); + const config = { + name, + compatibility_date: "2026-09-01", + assets: { directory }, + workers_dev: true, + preview_urls: true, + }; + fs.writeFileSync(file, + "// Generated by quantecon/actions/deploy-cloudflare for one deploy.\n" + + JSON.stringify(config, null, 2) + "\n"); + ' "$CONFIG" "$WORKER_NAME" "$BUILD_DIR" + cat "$CONFIG" + echo "path=$CONFIG" >> "$GITHUB_OUTPUT" + + # wrangler runs uncaptured, so its errors reach the log as they happen. + # #105 is what capturing into a variable under pipefail does: the step + # aborts at the assignment and the output is never printed. + - name: Deploy to production + id: deploy + shell: bash + env: + CLOUDFLARE_API_TOKEN: ${{ inputs.cloudflare-api-token }} + CLOUDFLARE_ACCOUNT_ID: ${{ inputs.cloudflare-account-id }} + WRANGLER_SEND_METRICS: 'false' + CI: 'true' + WRANGLER: ${{ steps.wrangler.outputs.bin }} + CONFIG: ${{ steps.config.outputs.path }} + DEPLOY_URL: ${{ steps.inputs.outputs.deploy-url }} + run: | + set -uo pipefail + message="${GITHUB_REPOSITORY}@${GITHUB_SHA:0:7} run ${GITHUB_RUN_ID}"; message=${message:0:100} + if ! "$WRANGLER" deploy --config "$CONFIG" --message "$message"; then + echo "::error::wrangler deploy failed; see its output above. A permissions error usually means the token lacks Editor on this Worker." + exit 1 + fi + echo "deploy-url=$DEPLOY_URL" >> "$GITHUB_OUTPUT" + echo "βœ… Deployed $DEPLOY_URL" + + # A regression guard: the pilot showed Access survives a redeploy, and the + # check before deploying already proved the gate. It stays because it is + # one request and the failure it guards is a private site gone public. + - name: Check the Access gate after deploying + id: gate-after + if: inputs.require-access == 'true' + shell: bash + env: + TEAM: ${{ steps.inputs.outputs.team-domain }} + URL: ${{ steps.inputs.outputs.deploy-url }} + PROBE_PATH: ${{ steps.inputs.outputs.probe-path }} + run: | + set -uo pipefail + urls=("$URL/") + [ -z "$PROBE_PATH" ] || urls+=("$URL$PROBE_PATH") + if ! bash "$GITHUB_ACTION_PATH/../scripts/check-access-gate.sh" "$TEAM" "${urls[@]}"; then + echo "::error::The new build is deployed but $URL is NOT behind Access for $TEAM. Treat the site as public until this is fixed: turn Access on (All traffic) for the Worker, or disable its workers.dev route." + exit 1 + fi + + - name: Upload preview alias + id: alias + if: inputs.alias != '' + shell: bash + env: + CLOUDFLARE_API_TOKEN: ${{ inputs.cloudflare-api-token }} + CLOUDFLARE_ACCOUNT_ID: ${{ inputs.cloudflare-account-id }} + WRANGLER_SEND_METRICS: 'false' + CI: 'true' + WRANGLER: ${{ steps.wrangler.outputs.bin }} + CONFIG: ${{ steps.config.outputs.path }} + ALIAS: ${{ inputs.alias }} + ALIAS_URL: ${{ steps.inputs.outputs.alias-url }} + run: | + set -uo pipefail + message="${GITHUB_REPOSITORY}@${GITHUB_SHA:0:7} run ${GITHUB_RUN_ID}"; message=${message:0:100} + if ! "$WRANGLER" versions upload --config "$CONFIG" --preview-alias "$ALIAS" --message "$message"; then + echo "::error::wrangler versions upload failed for alias [$ALIAS]; see its output above. Production is already deployed." + exit 1 + fi + echo "alias-url=$ALIAS_URL" >> "$GITHUB_OUTPUT" + echo "βœ… Uploaded $ALIAS_URL" + + # Preview URLs can be gated separately from production, so a gate that + # covers the Worker but not its previews would expose the alias. + - name: Check the Access gate on the alias + id: gate-alias + if: inputs.alias != '' && inputs.require-access == 'true' + shell: bash + env: + TEAM: ${{ steps.inputs.outputs.team-domain }} + URL: ${{ steps.inputs.outputs.alias-url }} + PROBE_PATH: ${{ steps.inputs.outputs.probe-path }} + run: | + set -uo pipefail + urls=("$URL/") + [ -z "$PROBE_PATH" ] || urls+=("$URL$PROBE_PATH") + if ! bash "$GITHUB_ACTION_PATH/../scripts/check-access-gate.sh" "$TEAM" "${urls[@]}"; then + echo "::error::The alias is uploaded but $URL is NOT behind Access for $TEAM. Treat it as public until this is fixed: set the Worker's Access to cover previews (All traffic)." + exit 1 + fi + + # On push, schedule and workflow_dispatch there is no PR to comment on, so + # the job summary is where the result is read. It runs on failure too: + # "refused, nothing uploaded" and "deployed, gate failed" need saying. + - name: Write job summary + if: always() + shell: bash + env: + WORKER_NAME: ${{ inputs.worker-name }} + TEAM: ${{ steps.inputs.outputs.team-domain }} + DEPLOY_URL: ${{ steps.inputs.outputs.deploy-url }} + ALIAS_URL: ${{ steps.inputs.outputs.alias-url }} + REQUIRE_ACCESS: ${{ inputs.require-access }} + INPUTS: ${{ steps.inputs.outcome }} + GATE_BEFORE: ${{ steps.gate-before.outcome }} + DEPLOY: ${{ steps.deploy.outcome }} + GATE_AFTER: ${{ steps.gate-after.outcome }} + ALIAS: ${{ steps.alias.outcome }} + GATE_ALIAS: ${{ steps.gate-alias.outcome }} + run: | + gate() { + case "$1" in + success) echo "βœ… redirects to \`$TEAM\`" ;; + failure) echo "🚨 **NOT GATED**, treat as public" ;; + *) [ "$REQUIRE_ACCESS" = "true" ] && echo "not checked" || echo "⚠️ not checked (\`require-access: false\`)" ;; + esac + } + { + echo "### ☁️ deploy-cloudflare: \`$WORKER_NAME\`" + echo + if [ "$INPUTS" != "success" ]; then + echo "❌ Inputs rejected, nothing was deployed. See the step log." + elif [ "$GATE_BEFORE" = "failure" ]; then + echo "β›” **Refused.** $DEPLOY_URL is not behind Access for \`$TEAM\`, so nothing was uploaded." + elif [ "$DEPLOY" != "success" ]; then + echo "❌ The deploy did not complete. See the wrangler output in the step log." + else + echo "| | URL | Access gate |" + echo "|---|---|---|" + echo "| Production | $DEPLOY_URL | $(gate "$GATE_AFTER") |" + if [ "$ALIAS" = "success" ]; then + echo "| Alias | $ALIAS_URL | $(gate "$GATE_ALIAS") |" + elif [ "$ALIAS" = "failure" ]; then + echo "| Alias | ❌ upload failed | |" + elif [ -n "$ALIAS_URL" ]; then + echo "| Alias | not uploaded, an earlier step failed | |" + fi + fi + } >> "$GITHUB_STEP_SUMMARY" + +branding: + icon: 'lock' + color: 'orange' diff --git a/deploy-cloudflare/package-lock.json b/deploy-cloudflare/package-lock.json new file mode 100644 index 0000000..f8a7ab7 --- /dev/null +++ b/deploy-cloudflare/package-lock.json @@ -0,0 +1,1452 @@ +{ + "name": "quantecon-deploy-cloudflare", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "quantecon-deploy-cloudflare", + "license": "MIT", + "dependencies": { + "wrangler": "4.136.3" + } + }, + "node_modules/@cloudflare/kv-asset-handler": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.5.0.tgz", + "integrity": "sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==", + "license": "MIT OR Apache-2.0", + "engines": { + "node": ">=22.0.0" + } + }, + "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==", + "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.20260921.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20260921.1.tgz", + "integrity": "sha512-3iB2WnYOlZ29T+1zhCwbHFExCBp6E9bgmDUMryATYwrIGEQ1YbvR78m4ydm56XKN/d/yF3803ivMGfZMYDtiMg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20260921.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20260921.1.tgz", + "integrity": "sha512-FpqVR7IQXVBmGtajyonEmhmb5UAsmV7dTaIkpemmHZXHEw7uYpkhkzKPjc4BOPhNQy8iwt2p+RZBPMY3Y7/bvQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20260921.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20260921.1.tgz", + "integrity": "sha512-riAJIohaVp5A8Sqy4yKlzHOaLPOICMf5oey+jC2rm45RVT+wK8+7UU0d31Dy/02Nc8YUkobAFwNVjX06P8WQ5g==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20260921.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20260921.1.tgz", + "integrity": "sha512-tnJu08tT7s0XWDqp3O0H/vCp0voy9OqVAzspb89biMo1dh8IiEpnyXnoPmdJ7H4qBnXCmXgy0kuEphuvpDPj9w==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20260921.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20260921.1.tgz", + "integrity": "sha512-VgNcRPstoZMb1G94JTrx+jU24GtkkazNfox0gnF/2fkuXpcfW/M0e0xvdMovYfwt8ZxG5AB2ZNvanD6ufBwiuQ==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "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==", + "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==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", + "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", + "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", + "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", + "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", + "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", + "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", + "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", + "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", + "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", + "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", + "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", + "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", + "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", + "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", + "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", + "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", + "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", + "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", + "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", + "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", + "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", + "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", + "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", + "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", + "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "cpu": [ + "x64" + ], + "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==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.4.tgz", + "integrity": "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA==", + "cpu": [ + "arm64" + ], + "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.3" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.4.tgz", + "integrity": "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw==", + "cpu": [ + "x64" + ], + "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.3" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.4.tgz", + "integrity": "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA==", + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.4" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.3.tgz", + "integrity": "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg==", + "cpu": [ + "arm64" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.3.tgz", + "integrity": "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw==", + "cpu": [ + "x64" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.3.tgz", + "integrity": "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==", + "cpu": [ + "arm" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.3.tgz", + "integrity": "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==", + "cpu": [ + "arm64" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.3.tgz", + "integrity": "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==", + "cpu": [ + "ppc64" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.3.tgz", + "integrity": "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==", + "cpu": [ + "riscv64" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.3.tgz", + "integrity": "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==", + "cpu": [ + "s390x" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.3.tgz", + "integrity": "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==", + "cpu": [ + "x64" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.3.tgz", + "integrity": "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==", + "cpu": [ + "arm64" + ], + "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.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.3.tgz", + "integrity": "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==", + "cpu": [ + "x64" + ], + "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.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.4.tgz", + "integrity": "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==", + "cpu": [ + "arm" + ], + "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.3" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.4.tgz", + "integrity": "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==", + "cpu": [ + "arm64" + ], + "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.3" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.4.tgz", + "integrity": "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==", + "cpu": [ + "ppc64" + ], + "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.3" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.4.tgz", + "integrity": "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==", + "cpu": [ + "riscv64" + ], + "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.3" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.4.tgz", + "integrity": "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==", + "cpu": [ + "s390x" + ], + "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.3" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.4.tgz", + "integrity": "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==", + "cpu": [ + "x64" + ], + "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.3" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.4.tgz", + "integrity": "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==", + "cpu": [ + "arm64" + ], + "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.3" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.4.tgz", + "integrity": "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==", + "cpu": [ + "x64" + ], + "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.3" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.4.tgz", + "integrity": "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==", + "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.4", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.4.tgz", + "integrity": "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.4" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.4.tgz", + "integrity": "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw==", + "cpu": [ + "arm64" + ], + "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.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.4.tgz", + "integrity": "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw==", + "cpu": [ + "ia32" + ], + "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.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.4.tgz", + "integrity": "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg==", + "cpu": [ + "x64" + ], + "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.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "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==", + "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==", + "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==", + "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==", + "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==", + "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==", + "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==", + "license": "CC0-1.0" + }, + "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==", + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "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==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "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==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/esbuild": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", + "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.1", + "@esbuild/android-arm": "0.28.1", + "@esbuild/android-arm64": "0.28.1", + "@esbuild/android-x64": "0.28.1", + "@esbuild/darwin-arm64": "0.28.1", + "@esbuild/darwin-x64": "0.28.1", + "@esbuild/freebsd-arm64": "0.28.1", + "@esbuild/freebsd-x64": "0.28.1", + "@esbuild/linux-arm": "0.28.1", + "@esbuild/linux-arm64": "0.28.1", + "@esbuild/linux-ia32": "0.28.1", + "@esbuild/linux-loong64": "0.28.1", + "@esbuild/linux-mips64el": "0.28.1", + "@esbuild/linux-ppc64": "0.28.1", + "@esbuild/linux-riscv64": "0.28.1", + "@esbuild/linux-s390x": "0.28.1", + "@esbuild/linux-x64": "0.28.1", + "@esbuild/netbsd-arm64": "0.28.1", + "@esbuild/netbsd-x64": "0.28.1", + "@esbuild/openbsd-arm64": "0.28.1", + "@esbuild/openbsd-x64": "0.28.1", + "@esbuild/openharmony-arm64": "0.28.1", + "@esbuild/sunos-x64": "0.28.1", + "@esbuild/win32-arm64": "0.28.1", + "@esbuild/win32-ia32": "0.28.1", + "@esbuild/win32-x64": "0.28.1" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.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==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/miniflare": { + "version": "5.20260921.0-alpha", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20260921.0-alpha.tgz", + "integrity": "sha512-vHH/unOYvV2jA1Q9SdkmzrQhhMoksdwg5jegu6ZeKaaRzgxZhVbt1NdTpQjHF2VTgiBjgP8SiUlUMfruB3N3SQ==", + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "sharp": "0.35.4", + "undici": "7.29.0", + "workerd": "1.20260921.1", + "ws": "8.21.0", + "youch": "4.1.0-beta.10" + }, + "engines": { + "node": ">=22.0.0" + } + }, + "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==", + "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==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.4.tgz", + "integrity": "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA==", + "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.4", + "@img/sharp-darwin-x64": "0.35.4", + "@img/sharp-freebsd-wasm32": "0.35.4", + "@img/sharp-libvips-darwin-arm64": "1.3.3", + "@img/sharp-libvips-darwin-x64": "1.3.3", + "@img/sharp-libvips-linux-arm": "1.3.3", + "@img/sharp-libvips-linux-arm64": "1.3.3", + "@img/sharp-libvips-linux-ppc64": "1.3.3", + "@img/sharp-libvips-linux-riscv64": "1.3.3", + "@img/sharp-libvips-linux-s390x": "1.3.3", + "@img/sharp-libvips-linux-x64": "1.3.3", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", + "@img/sharp-libvips-linuxmusl-x64": "1.3.3", + "@img/sharp-linux-arm": "0.35.4", + "@img/sharp-linux-arm64": "0.35.4", + "@img/sharp-linux-ppc64": "0.35.4", + "@img/sharp-linux-riscv64": "0.35.4", + "@img/sharp-linux-s390x": "0.35.4", + "@img/sharp-linux-x64": "0.35.4", + "@img/sharp-linuxmusl-arm64": "0.35.4", + "@img/sharp-linuxmusl-x64": "0.35.4", + "@img/sharp-webcontainers-wasm32": "0.35.4", + "@img/sharp-win32-arm64": "0.35.4", + "@img/sharp-win32-ia32": "0.35.4", + "@img/sharp-win32-x64": "0.35.4" + }, + "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==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD", + "optional": true + }, + "node_modules/undici": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz", + "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==", + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "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==", + "license": "MIT", + "dependencies": { + "pathe": "^2.0.3" + } + }, + "node_modules/workerd": { + "version": "1.20260921.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20260921.1.tgz", + "integrity": "sha512-4HyG7G1W4ksa6tUZ8bV2jxDRWuL5PXnHm9+Z1sjFPb9OZNoYtXz4y7QQRh4ibi0BF/lOmlAVjbhkUqsAVZuUKA==", + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20260921.1", + "@cloudflare/workerd-darwin-arm64": "1.20260921.1", + "@cloudflare/workerd-linux-64": "1.20260921.1", + "@cloudflare/workerd-linux-arm64": "1.20260921.1", + "@cloudflare/workerd-windows-64": "1.20260921.1" + } + }, + "node_modules/wrangler": { + "version": "4.136.3", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-4.136.3.tgz", + "integrity": "sha512-L1bS8BI9xoEk3RRr5XoZn5q5k1jCRo8+37ZEEab/jsUFzE1Ea2sIBAbmP1CdwSeD6mZYmnUtR6xpi9esHIl6GA==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@cloudflare/kv-asset-handler": "0.5.0", + "@cloudflare/unenv-preset": "2.16.2", + "blake3-wasm": "2.1.5", + "esbuild": "0.28.1", + "miniflare": "5.20260921.0-alpha", + "path-to-regexp": "6.3.0", + "unenv": "2.0.0-rc.24", + "workerd": "1.20260921.1" + }, + "bin": { + "cf-wrangler": "bin/cf-wrangler.js", + "wrangler": "bin/wrangler.js", + "wrangler2": "bin/wrangler.js" + }, + "engines": { + "node": ">=22.0.0" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "@cloudflare/workers-types": "^5.20260921.1" + }, + "peerDependenciesMeta": { + "@cloudflare/workers-types": { + "optional": true + } + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "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==", + "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==", + "license": "MIT", + "dependencies": { + "@poppinss/exception": "^1.2.2", + "error-stack-parser-es": "^1.0.5" + } + } + } +} diff --git a/deploy-cloudflare/package.json b/deploy-cloudflare/package.json new file mode 100644 index 0000000..de4161c --- /dev/null +++ b/deploy-cloudflare/package.json @@ -0,0 +1,9 @@ +{ + "name": "quantecon-deploy-cloudflare", + "private": true, + "description": "The wrangler CLI that deploy-cloudflare installs with `npm ci`. Exact pin; Dependabot proposes bumps.", + "license": "MIT", + "dependencies": { + "wrangler": "4.136.3" + } +} diff --git a/scripts/check-access-gate.sh b/scripts/check-access-gate.sh new file mode 100755 index 0000000..7bfd3cf --- /dev/null +++ b/scripts/check-access-gate.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# +# Prove that a site is behind Cloudflare Access: an unauthenticated request +# must be redirected to the team's own login domain, never answered with the +# content. Used by the deploy-cloudflare action before and after every deploy +# (#163). +# +# check-access-gate.sh [ ...] +# check-access-gate.sh quantecon.cloudflareaccess.com \ +# https://..workers.dev/ \ +# https://..workers.dev/data/latest.json +# +# Every URL must pass. Exit 0 = all gated, 1 = at least one is not, 2 = usage. +# +# Taken from the probe verified in the QuantEcon/status-projects#35 pilot +# (recorded on #163). What matters in it: +# +# - The Location host must EQUAL the team domain. Matching any +# *.cloudflareaccess.com would pass a Worker attached to the wrong Access +# organisation, which is exactly the mistake worth catching. +# - A 2xx gets its own loud branch. It means anonymous requests are being +# served the content: the one failure this check exists for. +# - No -L. Following the redirect lands on the login page and returns 200, +# which would make the alarm case and the success case look the same. +# - Anything else fails. A 404 or a redirect back to the site proves nothing +# about the gate, so it is never treated as a pass. + +set -uo pipefail + +if [ "$#" -lt 2 ]; then + echo "usage: check-access-gate.sh [ ...]" >&2 + exit 2 +fi + +team=$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]') +shift + +failed=0 +for url in "$@"; do + # --retry covers transport errors and 408/429/5xx only; a status we can + # judge is never retried into a different answer. + if ! out=$(curl -sS -o /dev/null --max-time 20 \ + --retry 2 --retry-delay 2 --retry-connrefused \ + -w '%{http_code} %{redirect_url}' "$url"); then + echo "::error::FAIL $url β€” could not be reached, so the gate could not be verified" + failed=1 + continue + fi + code=${out%% *} + location=${out#* } + + case "$code" in + 301|302|303|307|308) + host=${location#*://} + host=${host%%/*} + host=${host##*@} + host=${host%%:*} + host=$(printf '%s' "$host" | tr '[:upper:]' '[:lower:]') + if [ "$host" = "$team" ]; then + echo "PASS $code -> $host $url" + elif [[ "$host" == *.cloudflareaccess.com ]]; then + echo "::error::FAIL $url is gated by '$host', expected '$team' β€” the Worker is attached to the wrong Access organisation" + failed=1 + else + echo "::error::FAIL $url answered $code to '${host:-}', not to the Access login domain '$team' β€” the site is not behind Access" + failed=1 + fi + ;; + 2??) + echo "::error::FAIL $url answered $code without authentication β€” THE SITE IS PUBLIC" + failed=1 + ;; + 404) + echo "::error::FAIL $url answered 404 β€” nothing is gating this hostname (no such Worker, or its workers.dev route is off)" + failed=1 + ;; + *) + echo "::error::FAIL $url answered $code, expected a redirect to the Access login domain '$team'" + failed=1 + ;; + esac +done + +exit "$failed" From 83026670fe7b7e78e232fcc7f01c248f6fe945d4 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 23 Sep 2026 16:35:16 +0000 Subject: [PATCH 2/4] feat(deploy-cloudflare): harness coverage, shared config writer, docs (#163) - deploy-cloudflare/write-config.js: the generated wrangler config, moved out of an inline `node -e` so the harness dry-runs the exact file the action uses. - test-actions.yml: dc-gate-probe (every gate response shape against a local stand-in), dc-refuses-ungated (an ungated Worker is refused before wrangler is installed), dc-inputs (every invalid input fails in validation), dc-wrangler-config (the pinned wrangler accepts the generated config); all wired into harness-summary. - dependabot.yml: npm ecosystem for /deploy-cloudflare; the directory is added to the github-actions list for actions/setup-node. - deploy-cloudflare/README.md with the setup checklist; README, CHANGELOG, TESTING, QUICK-REFERENCE, ARCHITECTURE and copilot-instructions entries. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JxLZgJNNxNmNmeUUiD3SBW --- .github/copilot-instructions.md | 1 + .github/dependabot.yml | 29 +++ .github/workflows/test-actions.yml | 286 +++++++++++++++++++++++++++++ CHANGELOG.md | 29 +++ README.md | 5 + TESTING.md | 1 + deploy-cloudflare/README.md | 195 ++++++++++++++++++++ deploy-cloudflare/action.yml | 18 +- deploy-cloudflare/write-config.js | 36 ++++ docs/ARCHITECTURE.md | 1 + docs/QUICK-REFERENCE.md | 25 +++ 11 files changed, 610 insertions(+), 16 deletions(-) create mode 100644 deploy-cloudflare/README.md create mode 100644 deploy-cloudflare/write-config.js diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1e5fadb..0e53517 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -38,6 +38,7 @@ quantecon/actions/ β”œβ”€β”€ restore-jupyter-cache/ # Cache restore action (PRs) β”œβ”€β”€ preview-netlify/ # Netlify PR preview action β”œβ”€β”€ preview-cloudflare/ # Cloudflare Pages PR preview action +β”œβ”€β”€ deploy-cloudflare/ # Members-only Worker deploy behind Cloudflare Access β”œβ”€β”€ publish-gh-pages/ # GitHub Pages publishing action β”œβ”€β”€ templates/ # Workflow templates for lecture repos └── docs/ # Comprehensive documentation diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3d9c8c9..d0f1e36 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -85,6 +85,7 @@ updates: - "/restore-jupyter-cache" - "/preview-netlify" - "/preview-cloudflare" + - "/deploy-cloudflare" - "/publish-gh-pages" schedule: interval: "weekly" @@ -109,6 +110,34 @@ updates: # Don't propose bumps to our own internal sibling references (floating @v0). - dependency-name: "quantecon/actions*" + # ── npm (deploy-cloudflare's wrangler) ───────────────────────────────────── + # deploy-cloudflare installs wrangler with `npm ci` from the lockfile in its + # own directory, so the exact version is committed and bumps arrive here. + # The action harness dry-runs the generated config through the bumped + # wrangler (dc-wrangler-config), so a bump that breaks it goes red in CI. + - package-ecosystem: "npm" + directories: + - "/deploy-cloudflare" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + labels: + - "maintenance" + commit-message: + prefix: "deps" + groups: + npm: + patterns: + - "*" + update-types: + - "minor" + - "patch" + npm-major: + patterns: + - "*" + update-types: + - "major" + # ── Container base image ─────────────────────────────────────────────────── # Tracks the `FROM ubuntu:24.04` base in each Dockerfile (not the Miniconda # installer, which is pinned + checksummed in the RUN step). diff --git a/.github/workflows/test-actions.yml b/.github/workflows/test-actions.yml index 947952b..e70660c 100644 --- a/.github/workflows/test-actions.yml +++ b/.github/workflows/test-actions.yml @@ -857,6 +857,288 @@ jobs: [ ! -d _build/html ] || { echo "::error::_build/html present β€” the build cache leaked into an execution-type restore"; exit 1; } echo "βœ… execution cache round-trip: build-jupyter-cache β†’ restore-jupyter-cache" + # ========================================================================== + # deploy-cloudflare (#163) β€” no Cloudflare account, no secrets + # ========================================================================== + # + # A real deploy needs a gated Worker and a token, which a PR harness cannot + # hold, so the first real deploy is the only proof of that half. What these + # jobs can prove without one: that the gate probe tells every response shape + # apart, that the action refuses before installing anything when the gate is + # absent, that bad inputs fail fast, and that the pinned wrangler (which + # Dependabot bumps) still accepts the config the action generates. + + dc-gate-probe: + name: 'deploy-cloudflare: the Access gate probe tells every response shape apart' + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: gate + if: needs.gate.outputs.relevant == 'true' + steps: + - uses: actions/checkout@v7 + + # server.py answers each path the way one real configuration would; see + # its docstring. The probe's expected-failure annotations are rewritten + # so a green run does not show a wall of red ::error:: lines. + - name: Probe a local stand-in for each gate configuration + env: + TEAM: quantecon-harness.cloudflareaccess.com + run: | + set -euo pipefail + python3 .github/fixtures/access-gate/server.py 8765 > "$RUNNER_TEMP/server.log" 2>&1 & + for _ in $(seq 1 50); do curl -s -o /dev/null http://127.0.0.1:8765/missing && break; sleep 0.2; done + B=http://127.0.0.1:8765 + + expect() { + local want=$1 pattern=$2; shift 2 + local got=0 out + out=$(bash scripts/check-access-gate.sh "$@" 2>&1) || got=$? + printf '%s\n' "${out//::error::/ (expected) }" + [ "$got" = "$want" ] || { echo "::error::probe exited [$got], expected [$want] for: $*"; exit 1; } + grep -q -- "$pattern" <<< "$out" || { echo "::error::probe output lacks [$pattern] for: $*"; exit 1; } + } + + # Gated: the redirect lands on exactly the team domain, on the root + # and on an asset path, including a mixed-case host with :443. + expect 0 'PASS 302' "$TEAM" "$B/gated/" "$B/gated/data/latest.json" + expect 0 'PASS 302' "$TEAM" "$B/mixed-case" + expect 0 'PASS 302' "QuantEcon-Harness.CloudflareAccess.com" "$B/gated/" + + # Not gated, each for its own reason. + expect 1 'wrong Access organisation' "$TEAM" "$B/wrong-org/" + expect 1 'THE SITE IS PUBLIC' "$TEAM" "$B/public/" + expect 1 'not behind Access' "$TEAM" "$B/same-host/" + expect 1 '' "$TEAM" "$B/no-location" + expect 1 'answered 404' "$TEAM" "$B/missing" + expect 1 'answered 500' "$TEAM" "$B/broken" + expect 1 'could not be reached' "$TEAM" "http://127.0.0.1:9/" + # One public path fails the whole check, even when the root is gated: + # the case the asset probe exists for. + expect 1 'THE SITE IS PUBLIC' "$TEAM" "$B/gated/" "$B/public/data/latest.json" + + expect 2 'usage:' "$TEAM" + echo "βœ… check-access-gate.sh passes only a redirect to the exact team domain" + + dc-refuses-ungated: + name: 'deploy-cloudflare: refuses before installing anything when the Worker is not gated' + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: gate + if: needs.gate.outputs.relevant == 'true' + steps: + - uses: actions/checkout@v7 + + - name: Create a site to (not) deploy + run: | + mkdir -p harness-site/data + echo '

private

' > harness-site/index.html + echo '{}' > harness-site/data/latest.json + + # A real request to workers.dev for a Worker that does not exist: the + # answer is a 404 or an error, never a redirect to the team domain. If + # workers.dev is unreachable the probe fails too, so this cannot go + # green by accident. The token is fake: if the action got as far as + # wrangler, the directory assertion below would catch it. + - name: Deploy to a Worker that does not exist (expected to refuse) + id: deploy + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: 'harness-fake-token' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'harness-no-such-worker' + account-subdomain: 'quantecon-harness-nonexistent' + team-domain: 'quantecon-harness' + build-dir: 'harness-site' + + - name: Assert the refusal came before wrangler + env: + OUTCOME: ${{ steps.deploy.outcome }} + DEPLOY_URL: ${{ steps.deploy.outputs.deploy-url }} + run: | + [ "$OUTCOME" = "failure" ] || { echo "::error::outcome: expected [failure] for an ungated Worker, got [$OUTCOME]"; exit 1; } + [ -z "$DEPLOY_URL" ] || { echo "::error::deploy-url: expected empty (nothing deployed), got [$DEPLOY_URL]"; exit 1; } + # The prevention claim: wrangler was never even installed, so nothing + # can have been uploaded. + [ ! -e "$RUNNER_TEMP/deploy-cloudflare" ] || { echo "::error::$RUNNER_TEMP/deploy-cloudflare exists β€” the action reached the wrangler install despite the failed gate check"; exit 1; } + echo "βœ… an ungated Worker is refused before anything is installed or uploaded" + + dc-inputs: + name: 'deploy-cloudflare: invalid inputs fail before anything runs' + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: gate + if: needs.gate.outputs.relevant == 'true' + steps: + - uses: actions/checkout@v7 + + - name: Create a site + run: | + mkdir -p harness-site + echo '

private

' > harness-site/index.html + + # Secrets arrive empty, not absent, on fork and Dependabot runs. + - name: Empty token + id: token + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: '' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'harness-worker' + account-subdomain: 'quantecon-harness' + team-domain: 'quantecon-harness' + build-dir: 'harness-site' + + # The URL is constructed from the name, so it must be a hostname label. + - name: Worker name that is not a hostname label + id: worker + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: 'harness-fake-token' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'Harness_Worker' + account-subdomain: 'quantecon-harness' + team-domain: 'quantecon-harness' + build-dir: 'harness-site' + + # #163's own example. Cloudflare requires a leading letter and wrangler + # does not check before uploading. + - name: Alias starting with a digit + id: alias-digit + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: 'harness-fake-token' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'harness-worker' + account-subdomain: 'quantecon-harness' + team-domain: 'quantecon-harness' + build-dir: 'harness-site' + alias: '2026-08' + + - name: Alias too long for one hostname label + id: alias-long + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: 'harness-fake-token' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'harness-worker' + account-subdomain: 'quantecon-harness' + team-domain: 'quantecon-harness' + build-dir: 'harness-site' + alias: 'report-2026-08-with-a-description-long-enough-to-overflow' + + - name: Team domain that is not an Access login domain + id: team + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: 'harness-fake-token' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'harness-worker' + account-subdomain: 'quantecon-harness' + team-domain: 'quantecon.example.com' + build-dir: 'harness-site' + + # A typo must never read as "off". + - name: require-access that is neither true nor false + id: require + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: 'harness-fake-token' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'harness-worker' + account-subdomain: 'quantecon-harness' + team-domain: 'quantecon-harness' + build-dir: 'harness-site' + require-access: 'yes' + + - name: Missing build directory + id: build-dir + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: 'harness-fake-token' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'harness-worker' + account-subdomain: 'quantecon-harness' + team-domain: 'quantecon-harness' + build-dir: 'harness-no-such-dir' + + - name: Assert every invalid input failed and nothing was installed + env: + RESULTS: | + token ${{ steps.token.outcome }} ${{ steps.token.outputs.deploy-url }} + worker ${{ steps.worker.outcome }} ${{ steps.worker.outputs.deploy-url }} + alias-digit ${{ steps.alias-digit.outcome }} ${{ steps.alias-digit.outputs.deploy-url }} + alias-long ${{ steps.alias-long.outcome }} ${{ steps.alias-long.outputs.deploy-url }} + team ${{ steps.team.outcome }} ${{ steps.team.outputs.deploy-url }} + require ${{ steps.require.outcome }} ${{ steps.require.outputs.deploy-url }} + build-dir ${{ steps.build-dir.outcome }} ${{ steps.build-dir.outputs.deploy-url }} + run: | + set -euo pipefail + bad=0 n=0 + while read -r case outcome url; do + [ -n "$case" ] || continue + n=$((n + 1)) + if [ "$outcome" != "failure" ] || [ -n "${url:-}" ]; then + echo "::error::[$case]: expected outcome=failure and no deploy-url, got outcome=[$outcome] deploy-url=[${url:-}]" + bad=1 + else + echo "βœ“ $case rejected" + fi + done <<< "$RESULTS" + [ "$n" -eq 7 ] || { echo "::error::expected 7 cases, read $n"; exit 1; } + [ ! -e "$RUNNER_TEMP/deploy-cloudflare" ] || { echo "::error::$RUNNER_TEMP/deploy-cloudflare exists β€” an invalid input got as far as the wrangler install"; bad=1; } + [ "$bad" -eq 0 ] + echo "βœ… every invalid input fails in validation, before any network call or install" + + dc-wrangler-config: + name: 'deploy-cloudflare: the pinned wrangler accepts the generated config' + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: gate + if: needs.gate.outputs.relevant == 'true' + steps: + - uses: actions/checkout@v7 + + # The action installs Node itself only below 22; the runner's default + # may be older, so set it here the way the action would. + - uses: actions/setup-node@v7 + with: + node-version: '24' + package-manager-cache: false + + # Same lockfile, same config writer, same flags as the action, with + # --dry-run so no account is needed. This is the check a Dependabot bump + # of wrangler in deploy-cloudflare/package-lock.json runs against. + - name: Dry-run a deploy and an alias upload + env: + CI: 'true' + WRANGLER_SEND_METRICS: 'false' + run: | + set -euo pipefail + dir="$RUNNER_TEMP/wrangler-check" + mkdir -p "$dir" "$RUNNER_TEMP/site/data" + cp deploy-cloudflare/package.json deploy-cloudflare/package-lock.json "$dir/" + npm ci --prefix "$dir" --no-audit --no-fund + echo '

ok

' > "$RUNNER_TEMP/site/index.html" + echo '{}' > "$RUNNER_TEMP/site/data/latest.json" + + node deploy-cloudflare/write-config.js "$dir/harness.wrangler.jsonc" harness-worker "$RUNNER_TEMP/site" + cat "$dir/harness.wrangler.jsonc" + + wrangler="$dir/node_modules/.bin/wrangler" + "$wrangler" deploy --config "$dir/harness.wrangler.jsonc" --message "harness" --dry-run 2>&1 | tee "$RUNNER_TEMP/deploy.log" + grep -q 'files from the assets directory' "$RUNNER_TEMP/deploy.log" \ + || { echo "::error::wrangler deploy --dry-run did not read the assets directory from the generated config"; exit 1; } + "$wrangler" versions upload --config "$dir/harness.wrangler.jsonc" --preview-alias report-2026-08 --message "harness" --dry-run + echo "βœ… wrangler $("$wrangler" --version | tail -1) accepts the generated config for deploy and versions upload" + # ========================================================================== # Single anchor for branch protection # ========================================================================== @@ -883,6 +1165,10 @@ jobs: - bjc-abort-guard - bjc-restore-build - bjc-restore-exec + - dc-gate-probe + - dc-refuses-ungated + - dc-inputs + - dc-wrangler-config steps: # This is the job intended to be the single required status check, so it # has to be correct in BOTH shapes the gate can produce, and must never be diff --git a/CHANGELOG.md b/CHANGELOG.md index ae4f001..f63d5e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- **`deploy-cloudflare`**: a new action that publishes a built site to an existing Cloudflare + Worker behind Cloudflare Access, for members-only sites that GitHub Pages cannot serve on the + Team plan (Pages access control needs Enterprise Cloud). It runs on `push`, `schedule` and + `workflow_dispatch`; `preview-cloudflare` stays PR-only. The part worth building is the gate + check. An unauthenticated request must be answered with a redirect to **exactly** the team's + `.cloudflareaccess.com` login domain. A `2xx` fails as "the site is public", a redirect to + another Access organisation fails, and so does anything else, including an unreachable host. + The check runs **before** uploading, so a Worker that does not exist, is public, or is gated by + the wrong organisation is refused with nothing uploaded. It runs again after the deploy, and on + an optional preview alias (`alias: report-2026-08`) after its upload. Each check probes the site + root and one real non-HTML file from the build, so a gate on the entry point alone cannot pass. + The URLs are constructed from inputs, never parsed from wrangler's output. The action does not + create Workers or provision Access: an admin creates and gates each Worker once, and the deploy + token is account-owned with Editor on that one Worker, so it cannot create an ungated Worker + either. It takes the lessons of #105 for itself. wrangler is pinned exactly and installed with + `npm ci` from a committed lockfile (Dependabot now tracks npm for this directory), and it runs + uncaptured, so its errors reach the log. The action sets up Node 24 only when the runner has + less than 22. The probe, `scripts/check-access-gate.sh`, is the one verified in the + QuantEcon/status-projects#35 pilot. (#163) +- **CI**: four `deploy-cloudflare` harness jobs, none needing a Cloudflare account. + `dc-gate-probe` runs the probe against a local stand-in (`.github/fixtures/access-gate/`) for + every response shape. `dc-refuses-ungated` asserts that a Worker which does not exist is refused + before wrangler is even installed. `dc-inputs` asserts that every invalid input fails in + validation, including #163's own example alias `2026-08`, which Cloudflare rejects because + aliases must start with a letter. `dc-wrangler-config` dry-runs the generated config through the + pinned wrangler, which is what a Dependabot bump of the lockfile is tested against. A real deploy + is not covered; the first consumer deploy is its proof. (#163) + ### Changed - **Container images**: Node.js moves from 20 (end-of-life 2026-04-30) to 24 LTS. The lean image carried 20.17.0 and the full image 20.20.2. It no longer comes from conda, diff --git a/README.md b/README.md index c49cafa..991a7a7 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,11 @@ Deploys preview builds to Cloudflare Pages for pull requests. **Features:** Free for public & private repos, predictable URLs (`pr-N.project.pages.dev`), changed lecture detection, smart PR comments +### πŸ”’ [`deploy-cloudflare`](./deploy-cloudflare) +Publishes members-only sites to a Cloudflare Worker behind Cloudflare Access, from `push`, `schedule` or `workflow_dispatch`. + +**Features:** Proves the site is gated before and after every deploy (an anonymous request must redirect to your Access team's login) and refuses to upload otherwise, optional permanent preview alias per build, pinned wrangler, job-summary report + ### πŸš€ [`publish-gh-pages`](./publish-gh-pages) Publishes production builds to GitHub Pages using native artifact-based deployment. diff --git a/TESTING.md b/TESTING.md index 7200c66..b353420 100644 --- a/TESTING.md +++ b/TESTING.md @@ -34,6 +34,7 @@ The container fixture at `containers/quantecon/tests/minimal-jupyter-book/` also | `setup-environment` | Standard-mode conda cache, two-run missβ†’hit chain (the #33/#78 path, previously never confirmed by CI) | | `build-lectures` | Real HTML build of the fixture on the cache-restored conda env, executed-cell output asserted; plus the negative direction β€” a page whose code cell raises must fail the step, so a regression that swallows the build status cannot pass silently | | `build-jupyter-cache` | Smoke build + outputs, then a full round-trip into `restore-jupyter-cache` for both cache types. ⚠️ Its internal `setup-environment`/`build-lectures` calls run `@v0`, not the PR β€” GitHub forbids expressions in `uses:`, so that chain is untestable pre-release by construction (see #100) | +| `deploy-cloudflare` | Everything short of a real deploy: the Access gate probe against a local stand-in for every response shape (exact team domain passes; wrong org, public `2xx`, same-host redirect, missing `Location`, `404`, `5xx`, unreachable, and a public asset behind a gated root all fail); the action refusing an ungated Worker **before wrangler is even installed**, asserted on the filesystem; every invalid input failing in validation; and the pinned wrangler accepting the generated config (`--dry-run` deploy and alias upload), which is what a Dependabot bump of the lockfile runs against. ❌ A real deploy needs a gated Worker and a token, so the first consumer deploy is its only proof | | `publish-gh-pages`, `preview-netlify`, `preview-cloudflare` | ❌ Not covered β€” need real deploy targets and secrets; owned by the post-release canary repo (stage 2+ of #100) | --- diff --git a/deploy-cloudflare/README.md b/deploy-cloudflare/README.md new file mode 100644 index 0000000..41eda80 --- /dev/null +++ b/deploy-cloudflare/README.md @@ -0,0 +1,195 @@ +# Deploy Cloudflare Action + +Publishes a built site to an existing Cloudflare Worker behind Cloudflare Access, for sites only members should see, and fails the job unless the site is proven gated. + +GitHub Pages stays the route for everything public ([`publish-gh-pages`](../publish-gh-pages)). What Pages cannot do on the org's Team plan is serve a site to members only, since Pages access control needs Enterprise Cloud. Cloudflare Access in front of a Worker's static assets does, for free at this scale. PR previews are a different action ([`preview-cloudflare`](../preview-cloudflare)). + +## Features + +- πŸ”’ **Proves the gate before uploading.** If an anonymous request to the Worker is not redirected to your Access team's login, nothing is uploaded. That refuses a Worker that does not exist, one that is public, and one gated by the wrong Access organisation. +- πŸ” **Proves it again after deploying**, on the site root and on one real file from the build, so a site that is silently public fails the job instead of passing it. +- πŸ—‚οΈ **Optional preview alias**, for example `report-2026-08`: a permanent URL for this build alongside the moving production URL. The alias is gate-checked too. +- πŸ“Œ **Pinned wrangler**, installed with `npm ci` from a committed lockfile and kept current by Dependabot. +- πŸ“ **Job summary.** On `push`, `schedule` and `workflow_dispatch` there is no PR to comment on, so the result (including "refused" or "deployed but not gated") goes to the job summary. + +## Usage + +```yaml +name: Publish members dashboard +on: + push: + branches: [main] + schedule: + - cron: '0 6 * * *' + workflow_dispatch: + +# One deploy at a time per site; a queued run deploys the newest build. +concurrency: + group: deploy-cloudflare-${{ github.workflow }} + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v7 + + - name: Build + run: ./build.sh # writes the site to _site/ + + - uses: quantecon/actions/deploy-cloudflare@v0 + with: + cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} + cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + worker-name: members-dashboard + account-subdomain: my-subdomain # *.my-subdomain.workers.dev + team-domain: my-team.cloudflareaccess.com + build-dir: _site +``` + +A monthly report that also keeps a permanent URL per month: + +```yaml + - name: Name this month's alias + id: month + run: echo "alias=report-$(date -u +%Y-%m)" >> "$GITHUB_OUTPUT" + + - uses: quantecon/actions/deploy-cloudflare@v0 + with: + cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} + cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + worker-name: monthly-report + account-subdomain: my-subdomain + team-domain: my-team.cloudflareaccess.com + build-dir: _build/html + alias: ${{ steps.month.outputs.alias }} # report-2026-08 +``` + +> **New action.** `deploy-cloudflare` ships in the first release after v0.11.1. Until then, `@v0` does not contain it; reference `@main` for testing only. + +## Requirements + +- **A Worker that already exists and is already behind Access.** The action never creates a Worker or turns Access on. See the [setup checklist](#setup-checklist). +- **Node.js 22 or later.** wrangler refuses to run below 22. If the runner has an older Node or none, the action sets up Node 24 itself. The QuantEcon containers (`ghcr.io/quantecon/quantecon`, `ghcr.io/quantecon/quantecon-build`) already carry Node 24. +- **`bash`, `curl` and `npm`**, all present on GitHub-hosted runners and in the QuantEcon containers. +- **Secrets** `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`. Secrets are not passed to workflows triggered from forks or by Dependabot. The action then fails in validation, before any network call. + +## Inputs + +| Input | Description | Required | Default | +|-------|-------------|----------|---------| +| `cloudflare-api-token` | Account-owned token with **Editor on this Worker only** (see the checklist) | Yes | - | +| `cloudflare-account-id` | Cloudflare account ID | Yes | - | +| `worker-name` | The Worker to deploy to, one per site. Lowercase letters, digits and dashes | Yes | - | +| `account-subdomain` | The account's `workers.dev` subdomain: `my-subdomain` for `*.my-subdomain.workers.dev` (`my-subdomain.workers.dev` is accepted too) | Yes | - | +| `team-domain` | The Access team's login domain, `.cloudflareaccess.com` (a bare `` is accepted) | Yes | - | +| `build-dir` | Directory with the built site | Yes | - | +| `alias` | Also upload this build as a named preview alias. Lowercase letters, digits and dashes, **starting with a letter** (`report-2026-08`, not `2026-08`), and `-` must fit in 63 characters | No | `''` | +| `require-access` | Check the gate before and after deploying. `false` skips both checks, with a warning. Never set it for private content | No | `true` | + +The URLs are **constructed** from `worker-name`, `account-subdomain` and `alias`, never parsed from wrangler's output, following the same approach as `preview-cloudflare` (#131). + +## Outputs + +| Output | Description | +|--------|-------------| +| `deploy-url` | `https://{worker}.{subdomain}.workers.dev`. Set once the production deploy succeeds (even if the gate check after it then fails the job) | +| `alias-url` | `https://{alias}-{worker}.{subdomain}.workers.dev`. Empty when no alias is given or the upload did not happen | + +## What the gate check proves + +The check is [`scripts/check-access-gate.sh`](../scripts/check-access-gate.sh), taken from the probe verified in the status-projects pilot (QuantEcon/status-projects#35). It sends an unauthenticated request and **does not follow redirects**: following one would land on the login page and return `200`, making a gated site and a public one look the same. + +| Response | Verdict | +|----------|---------| +| `301/302/303/307/308` to exactly `team-domain` | βœ… gated | +| Redirect to a different `*.cloudflareaccess.com` | ❌ gated by the **wrong Access organisation** | +| `2xx` | ❌ **the site is public** | +| `404` | ❌ no Worker answers on that hostname, or its `workers.dev` route is off | +| Anything else, or unreachable | ❌ the gate could not be verified. The check fails closed | + +Every check probes the site root **and one non-HTML file from `build-dir`** (the first in sorted order with a URL-safe path, skipping dotfiles). A gate that protects only the entry point would be an easy mistake to make and invisible from the root. In the pilot, `data/latest.json` got the same redirect as `/`, as it should: Access covers every path on the hostname. + +The action runs the check at three points: + +1. **Before uploading.** This is prevention. Deploying content first and turning Access on afterwards would leave private data on a public hostname for the length of the setup. +2. **After deploying.** This is a regression guard. The pilot showed Access survives a redeploy, but the check is one request, and it guards against a private site silently going public. +3. **After the alias upload.** Preview URLs can be gated separately from production, so the alias gets its own check. + +You can run the same check by hand: + +```bash +bash scripts/check-access-gate.sh my-team.cloudflareaccess.com \ + https://members-dashboard.my-subdomain.workers.dev/ +# PASS 302 -> my-team.cloudflareaccess.com https://members-dashboard.my-subdomain.workers.dev/ +``` + +## Setup checklist + +### Once per Cloudflare account + +1. **Zero Trust organisation.** The team name you choose gives the login domain `.cloudflareaccess.com`, which is the `team-domain` input. The free tier covers 50 users. +2. **GitHub as the login method.** Create an OAuth App under the **organisation's** developer settings (GitHub β†’ the org β†’ Settings β†’ Developer settings β†’ OAuth Apps). An app created under the organisation itself needs no approval under the org's OAuth app access restrictions, while one under a personal account does. + - Homepage URL: `https://.cloudflareaccess.com` + - Authorization callback URL: `https://.cloudflareaccess.com/cdn-cgi/access/callback` + + Then add it in Zero Trust under Settings β†’ Authentication β†’ Login methods β†’ GitHub. +3. **Make GitHub the only login method.** New Zero Trust accounts default to *Cloudflare account membership*, not one-time PIN. Remove that default. +4. **One reusable policy per audience.** Under Access controls β†’ Policies, create an Allow policy with the **GitHub Organization** selector, the organisation `QuantEcon` and a **named team**, and reference it from each application. Use a team, not the whole organisation: org membership counted 82 accounts across 23 teams, including translation collaborators and course teams, which is the wrong audience for a grants dashboard. The pilot's policy is `QuantEcon Dashboards` (`QuantEcon` + team `dashboards`). Sessions can last up to one month. + +### Once per site + +1. **Create the Worker by hand, under its final name**, as a placeholder that holds no data (for example the dashboard's Hello World template). Keep its `workers.dev` route enabled: the action deploys to and checks `https://{worker}.{subdomain}.workers.dev`. Creating a Worker needs Admin at the Workers product scope, which the deploy token deliberately lacks ([Cloudflare docs](https://developers.cloudflare.com/workers/authorization/)). +2. **Turn Access on for the Worker with *All traffic*,** not *Previews only*. This protects the `workers.dev` hostname, every preview URL (so every alias), and any custom domain attached later. Attach the reusable policy and turn on instant authentication. Use this per-Worker setting rather than the account-wide "Protect all Workers" switch, because the same account hosts public lecture previews. +3. **Prove the gate on the placeholder** before the first real deploy: + ```bash + bash scripts/check-access-gate.sh .cloudflareaccess.com https://..workers.dev/ + ``` + The action repeats this check before every deploy and refuses if it fails, but proving it here first catches a setup mistake before any workflow depends on it. +4. **Create the deploy token:** an account-owned API token with **Editor on this one Worker** (Cloudflare's per-Worker roles), not the legacy account-wide *Workers Scripts: Edit*. It can deploy this Worker but cannot create one, so a mistyped `worker-name` fails instead of creating a new, ungated Worker. The gate check before uploading refuses that case too, whatever the token can do. +5. **Add the secrets to the consumer repository** (Settings β†’ Secrets and variables β†’ Actions): + + | Secret | Value | + |--------|-------| + | `CLOUDFLARE_API_TOKEN` | The per-Worker token from step 4 | + | `CLOUDFLARE_ACCOUNT_ID` | Dashboard URL `https://dash.cloudflare.com/{account-id}/...`, or Workers & Pages β†’ Overview | + +### Why the action does not do this setup itself + +The Access application is one-time per Worker, and the identity provider is one-time per account. Provisioning either from CI would put an `Access: Apps and Policies: Edit` token into every consumer repository for a step that runs once. For the same reason the action cannot create the Worker: its token can only deploy to one that exists. If the org ever wants the account under code, the Terraform resources `zero_trust_access_application` and `zero_trust_access_policy` cover it. + +## Notes + +- **Custom domains** are a per-Worker setting in the dashboard, and the Worker's Access application picks them up automatically. The action does not manage domains: its generated config declares no routes, so a deploy leaves dashboard-attached domains alone, and it always checks the `workers.dev` URL. +- **The generated config** ([`write-config.js`](write-config.js)) sets the name, a fixed `compatibility_date`, `assets.directory`, `workers_dev: true` and `preview_urls: true`. It is written to `RUNNER_TEMP` for each run, so consumer repositories need no wrangler config. wrangler running in CI overwrites settings changed in the dashboard (such as the placeholder's script) without prompting. +- **A blank page after access is granted.** On the first load after access is granted or restored, cached Access redirects for `style.css`, `app.js` and data files can be served in place of the real assets. A plain refresh fixes it. +- **A user added to the team after being denied** may stay denied until they revoke the OAuth app in their GitHub settings and log in again. This is documented Cloudflare behaviour, though it did not reproduce on the path the pilot tested. +- **Limits.** Workers static assets allow 20,000 files and 25 MiB per file per version on the free plan (100,000 files on paid). The 1,000 most recent preview aliases are kept per Worker. Lecture-sized Jupyter Books are a few thousand files. + +## Troubleshooting + +### "Refusing to deploy: … is not behind Access" + +Nothing was uploaded. The line above it says why: +- **`answered 404`**: no Worker by that name under that `account-subdomain`, or its `workers.dev` route is off. Check both, and create the Worker first if it is new. +- **`THE SITE IS PUBLIC`**: Access is off for the Worker, or set to *Previews only*. Turn it on with *All traffic*. +- **`wrong Access organisation`**: the Worker's Access application belongs to a different Zero Trust team, or `team-domain` is wrong. +- **`could not be reached`**: a network problem between the runner and Cloudflare. Re-run the job. + +### "wrangler deploy failed" + +wrangler's own error is printed above the annotation. An authentication or permission error usually means the token lacks Editor on this Worker, the account ID is wrong, or the token has expired. + +### "The new build is deployed but … is NOT behind Access" + +This is the urgent one: the content is live and anonymous requests are not being redirected. Turn Access on (*All traffic*) for the Worker, or disable its `workers.dev` route, then re-run the job to confirm. + +### "The alias is uploaded but … is NOT behind Access" + +Production is gated but previews are not. Set the Worker's Access to *All traffic*, which covers preview URLs. + +### An alias is rejected before anything runs + +Aliases must start with a lowercase letter and use only lowercase letters, digits and dashes, and `-` must fit in 63 characters. Use `report-2026-08`, not `2026-08`. diff --git a/deploy-cloudflare/action.yml b/deploy-cloudflare/action.yml index ef4ac26..bab4f8d 100644 --- a/deploy-cloudflare/action.yml +++ b/deploy-cloudflare/action.yml @@ -209,8 +209,7 @@ runs: echo "bin=$dir/node_modules/.bin/wrangler" >> "$GITHUB_OUTPUT" echo "dir=$dir" >> "$GITHUB_OUTPUT" - # Generated per run, not committed per repo. Paths in a wrangler config - # resolve against the config file, so the assets directory is absolute. + # Generated per run, not committed per repo; see write-config.js. - name: Write the Worker config id: config shell: bash @@ -220,20 +219,7 @@ runs: BUILD_DIR: ${{ steps.inputs.outputs.build-dir }} run: | set -euo pipefail - node -e ' - const fs = require("fs"); - const [file, name, directory] = process.argv.slice(1); - const config = { - name, - compatibility_date: "2026-09-01", - assets: { directory }, - workers_dev: true, - preview_urls: true, - }; - fs.writeFileSync(file, - "// Generated by quantecon/actions/deploy-cloudflare for one deploy.\n" + - JSON.stringify(config, null, 2) + "\n"); - ' "$CONFIG" "$WORKER_NAME" "$BUILD_DIR" + node "$GITHUB_ACTION_PATH/write-config.js" "$CONFIG" "$WORKER_NAME" "$BUILD_DIR" cat "$CONFIG" echo "path=$CONFIG" >> "$GITHUB_OUTPUT" diff --git a/deploy-cloudflare/write-config.js b/deploy-cloudflare/write-config.js new file mode 100644 index 0000000..1b8d408 --- /dev/null +++ b/deploy-cloudflare/write-config.js @@ -0,0 +1,36 @@ +// Writes the wrangler config that deploy-cloudflare deploys with: +// +// node write-config.js +// +// Generated per run rather than committed per repo, so consumers stay +// config-free. Paths in a wrangler config resolve against the config file, +// which lives in RUNNER_TEMP, so the assets directory must be absolute. +// +// The action harness runs this same file through the pinned wrangler with +// --dry-run, so a wrangler bump that stops accepting this shape fails CI +// rather than a consumer's deploy. +const fs = require("fs"); +const path = require("path"); + +const [file, name, directory] = process.argv.slice(2); +if (!file || !name || !directory || !path.isAbsolute(directory)) { + console.error("usage: node write-config.js "); + process.exit(2); +} + +const config = { + name, + compatibility_date: "2026-09-01", + assets: { directory }, + // The production URL the action constructs and probes. + workers_dev: true, + // Needed for `alias`. Previews sit behind the same Access application + // when it is set to All traffic, and the alias is probed after upload. + preview_urls: true, +}; + +fs.writeFileSync( + file, + "// Generated by quantecon/actions/deploy-cloudflare for one deploy.\n" + + JSON.stringify(config, null, 2) + "\n" +); diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index d80aa4f..999235b 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -32,6 +32,7 @@ restore-jupyter-cache/β†’ Restore execution cache (PR workflows) build-lectures/ β†’ Build Jupyter Book (multi-format, asset assembly) preview-netlify/ β†’ Deploy to Netlify for PR previews preview-cloudflare/ β†’ Deploy to Cloudflare Pages for PR previews +deploy-cloudflare/ β†’ Deploy a members-only site to a Cloudflare Worker behind Access publish-gh-pages/ β†’ Deploy to GitHub Pages ``` diff --git a/docs/QUICK-REFERENCE.md b/docs/QUICK-REFERENCE.md index d114698..b611bbf 100644 --- a/docs/QUICK-REFERENCE.md +++ b/docs/QUICK-REFERENCE.md @@ -12,6 +12,7 @@ A cheat sheet for using QuantEcon composite actions in your workflows. | `restore-jupyter-cache` | Cache restore for PRs (read-only by default; optional `save-cache`) | ~14 min (avoids full rebuild) | | `preview-netlify` | PR preview deployment (Netlify) | ~1 min | | `preview-cloudflare` | PR preview deployment (Cloudflare) | ~1 min | +| `deploy-cloudflare` | Members-only site on a Cloudflare Worker behind Access, gate-checked | ~1 min | | `publish-gh-pages` | GitHub Pages deployment | ~30 sec | ## πŸš€ Quick Start @@ -231,6 +232,19 @@ build-dir: '_build/html' # Required lectures-dir: 'lectures' # For change detection (default) ``` +### deploy-cloudflare + +```yaml +cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} # Required - Editor on this Worker only +cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} # Required +worker-name: 'members-dashboard' # Required - must already exist and be behind Access +account-subdomain: 'my-subdomain' # Required - *.my-subdomain.workers.dev +team-domain: 'my-team.cloudflareaccess.com' # Required - the gate must redirect here +build-dir: '_site' # Required +alias: '' # Optional permanent preview alias, e.g. report-2026-08 +require-access: 'true' # Gate check before and after deploying (default) +``` + ### publish-gh-pages ```yaml @@ -267,6 +281,17 @@ permissions: # - ${{ steps.netlify.outputs.changed-files }} ``` +### deploy-cloudflare + +```yaml +- id: private + uses: quantecon/actions/deploy-cloudflare@v0 + +# Access: +# - ${{ steps.private.outputs.deploy-url }} +# - ${{ steps.private.outputs.alias-url }} +``` + ### publish-gh-pages ```yaml From 5a8cb9715c128b52d24210acff0dd2743eaa4946 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 23 Sep 2026 16:58:15 +0000 Subject: [PATCH 3/4] fix(deploy-cloudflare): gate the version preview URL, check after a failed deploy (#163) From an adversarial review of the branch: - Every deploy gets its own preview URL (preview_urls: true), which no check covered when no alias was given. The check after deploying now probes https://-..workers.dev too, from the "Current Version ID" wrangler prints, and fails closed if it is missing. - wrangler can exit non-zero after the new version is live, which used to skip the check after deploying. It now runs whenever wrangler was attempted, and the summary says the build may be live. - check-access-gate.sh refuses an empty or malformed team domain (exit 2; an empty team matched a Location-less 302) and a Location whose host is hidden behind userinfo or a backslash. - build-dir may not contain line breaks, which would inject outputs. - Harness: dc-inputs sets require-access: 'false' on every case but one, so a dropped validation rule cannot hide behind the gate check; dc-refuses-ungated gains a positive control showing the same inputs reach wrangler with the gate off; dc-wrangler-config fails on wrangler's "Unexpected fields" warning; dc-gate-probe covers the new cases. - Docs brought in line: require-access covers every check, troubleshooting names every refusal message, copilot-instructions counts 8 actions. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JxLZgJNNxNmNmeUUiD3SBW --- .github/copilot-instructions.md | 2 +- .github/fixtures/access-gate/server.py | 4 ++ .github/workflows/test-actions.yml | 51 ++++++++++++++++- CHANGELOG.md | 15 +++-- TESTING.md | 2 +- deploy-cloudflare/README.md | 25 ++++++--- deploy-cloudflare/action.yml | 76 ++++++++++++++++++++------ scripts/check-access-gate.sh | 22 ++++++-- 8 files changed, 155 insertions(+), 42 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 0e53517..6cc2dc8 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -133,5 +133,5 @@ gh run view RUN_ID --log > /tmp/gh-logs.txt && cat /tmp/gh-logs.txt - **Updated:** June 16, 2026 - **Current Phase:** Infrastructure complete, ready for production migration (latest release: v0.8.0) - **Containers:** ghcr.io/quantecon/quantecon:latest (full, ~8GB), ghcr.io/quantecon/quantecon-build:latest (lean, ~3GB) -- **Actions:** 7 composite actions complete and tested +- **Actions:** 8 composite actions (`deploy-cloudflare`'s real deploy is not exercised in CI; see TESTING.md) - **Next:** Begin Phase 1 migration with lecture-dp repo diff --git a/.github/fixtures/access-gate/server.py b/.github/fixtures/access-gate/server.py index 6de2194..4188cbf 100644 --- a/.github/fixtures/access-gate/server.py +++ b/.github/fixtures/access-gate/server.py @@ -11,6 +11,8 @@ /missing 404 (no Worker on this hostname) /broken 500 (retried by the probe, then fails) /mixed-case 302 to the team domain in mixed case with an explicit :443 + /userinfo 302 whose real host is not the team domain, hidden behind + `\\@team-domain` userinfo Usage: python3 server.py """ @@ -36,6 +38,8 @@ def do_GET(self): self.reply(302, {}) elif path == "/broken": self.reply(500, {}) + elif path == "/userinfo": + self.reply(302, {"Location": "https://evil.example\\@quantecon-harness.cloudflareaccess.com/"}) elif path == "/mixed-case": self.reply(302, {"Location": "https://QuantEcon-Harness.CloudflareAccess.com:443/cdn-cgi/access/login/site"}) else: diff --git a/.github/workflows/test-actions.yml b/.github/workflows/test-actions.yml index e70660c..8be57b5 100644 --- a/.github/workflows/test-actions.yml +++ b/.github/workflows/test-actions.yml @@ -911,12 +911,15 @@ jobs: expect 1 '' "$TEAM" "$B/no-location" expect 1 'answered 404' "$TEAM" "$B/missing" expect 1 'answered 500' "$TEAM" "$B/broken" + expect 1 'ambiguous Location' "$TEAM" "$B/userinfo" expect 1 'could not be reached' "$TEAM" "http://127.0.0.1:9/" # One public path fails the whole check, even when the root is gated: # the case the asset probe exists for. expect 1 'THE SITE IS PUBLIC' "$TEAM" "$B/gated/" "$B/public/data/latest.json" expect 2 'usage:' "$TEAM" + # An empty team must not match the empty host of a Location-less 302. + expect 2 'must be ' "" "$B/no-location" echo "βœ… check-access-gate.sh passes only a redirect to the exact team domain" dc-refuses-ungated: @@ -963,6 +966,33 @@ jobs: [ ! -e "$RUNNER_TEMP/deploy-cloudflare" ] || { echo "::error::$RUNNER_TEMP/deploy-cloudflare exists β€” the action reached the wrangler install despite the failed gate check"; exit 1; } echo "βœ… an ungated Worker is refused before anything is installed or uploaded" + # Positive control, so the refusal above is attributable to the gate + # check: the same inputs with the gate off pass validation, set up Node + # and install the pinned wrangler, and only then fail (the token is fake). + - name: Same inputs with the gate off (expected to reach wrangler, then fail) + id: control + continue-on-error: true + uses: ./deploy-cloudflare + with: + cloudflare-api-token: 'harness-fake-token' + cloudflare-account-id: '00000000000000000000000000000000' + worker-name: 'harness-no-such-worker' + account-subdomain: 'quantecon-harness-nonexistent' + team-domain: 'quantecon-harness' + build-dir: 'harness-site' + require-access: 'false' + + - name: Assert only the gate check stood between these inputs and wrangler + env: + OUTCOME: ${{ steps.control.outcome }} + DEPLOY_URL: ${{ steps.control.outputs.deploy-url }} + run: | + [ "$OUTCOME" = "failure" ] || { echo "::error::outcome: expected [failure] with a fake token, got [$OUTCOME]"; exit 1; } + [ -z "$DEPLOY_URL" ] || { echo "::error::deploy-url: expected empty with a fake token, got [$DEPLOY_URL]"; exit 1; } + [ -x "$RUNNER_TEMP/deploy-cloudflare/node_modules/.bin/wrangler" ] || { echo "::error::wrangler was not installed β€” the same inputs did not get past validation and the Node/npm steps with the gate off"; exit 1; } + [ -f "$RUNNER_TEMP/deploy-cloudflare/harness-no-such-worker.wrangler.jsonc" ] || { echo "::error::the generated config is missing β€” the action stopped before writing it"; exit 1; } + echo "βœ… with the gate off the same inputs reach wrangler, so the refusal above came from the gate check" + dc-inputs: name: 'deploy-cloudflare: invalid inputs fail before anything runs' runs-on: ubuntu-latest @@ -977,6 +1007,11 @@ jobs: mkdir -p harness-site echo '

private

' > harness-site/index.html + # Every case but `require` also sets require-access: 'false', so a + # validation rule that went missing would reach the wrangler install (the + # gate check would otherwise fail the case for a different reason) and + # the directory assertion at the end would catch it. + # Secrets arrive empty, not absent, on fork and Dependabot runs. - name: Empty token id: token @@ -989,6 +1024,7 @@ jobs: account-subdomain: 'quantecon-harness' team-domain: 'quantecon-harness' build-dir: 'harness-site' + require-access: 'false' # The URL is constructed from the name, so it must be a hostname label. - name: Worker name that is not a hostname label @@ -1002,6 +1038,7 @@ jobs: account-subdomain: 'quantecon-harness' team-domain: 'quantecon-harness' build-dir: 'harness-site' + require-access: 'false' # #163's own example. Cloudflare requires a leading letter and wrangler # does not check before uploading. @@ -1016,6 +1053,7 @@ jobs: account-subdomain: 'quantecon-harness' team-domain: 'quantecon-harness' build-dir: 'harness-site' + require-access: 'false' alias: '2026-08' - name: Alias too long for one hostname label @@ -1029,6 +1067,7 @@ jobs: account-subdomain: 'quantecon-harness' team-domain: 'quantecon-harness' build-dir: 'harness-site' + require-access: 'false' alias: 'report-2026-08-with-a-description-long-enough-to-overflow' - name: Team domain that is not an Access login domain @@ -1042,8 +1081,10 @@ jobs: account-subdomain: 'quantecon-harness' team-domain: 'quantecon.example.com' build-dir: 'harness-site' + require-access: 'false' - # A typo must never read as "off". + # A typo must never read as "off". The one case left with the gate on: + # an unrecognised value must not reach it, or skip it. - name: require-access that is neither true nor false id: require continue-on-error: true @@ -1068,6 +1109,7 @@ jobs: account-subdomain: 'quantecon-harness' team-domain: 'quantecon-harness' build-dir: 'harness-no-such-dir' + require-access: 'false' - name: Assert every invalid input failed and nothing was installed env: @@ -1136,7 +1178,12 @@ jobs: "$wrangler" deploy --config "$dir/harness.wrangler.jsonc" --message "harness" --dry-run 2>&1 | tee "$RUNNER_TEMP/deploy.log" grep -q 'files from the assets directory' "$RUNNER_TEMP/deploy.log" \ || { echo "::error::wrangler deploy --dry-run did not read the assets directory from the generated config"; exit 1; } - "$wrangler" versions upload --config "$dir/harness.wrangler.jsonc" --preview-alias report-2026-08 --message "harness" --dry-run + "$wrangler" versions upload --config "$dir/harness.wrangler.jsonc" --preview-alias report-2026-08 --message "harness" --dry-run 2>&1 | tee "$RUNNER_TEMP/upload.log" + # wrangler only warns on a config key it no longer knows, and a + # dropped key (preview_urls, say) would silently change behaviour. + if grep -q 'Unexpected fields' "$RUNNER_TEMP/deploy.log" "$RUNNER_TEMP/upload.log"; then + echo "::error::the pinned wrangler does not recognise a key in the generated config (see 'Unexpected fields' above)"; exit 1 + fi echo "βœ… wrangler $("$wrangler" --version | tail -1) accepts the generated config for deploy and versions upload" # ========================================================================== diff --git a/CHANGELOG.md b/CHANGELOG.md index f63d5e0..411d192 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,10 +16,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `.cloudflareaccess.com` login domain. A `2xx` fails as "the site is public", a redirect to another Access organisation fails, and so does anything else, including an unreachable host. The check runs **before** uploading, so a Worker that does not exist, is public, or is gated by - the wrong organisation is refused with nothing uploaded. It runs again after the deploy, and on - an optional preview alias (`alias: report-2026-08`) after its upload. Each check probes the site - root and one real non-HTML file from the build, so a gate on the entry point alone cannot pass. - The URLs are constructed from inputs, never parsed from wrangler's output. The action does not + the wrong organisation is refused with nothing uploaded. It runs again after the deploy, on + production and on the new version's own preview URL (the config enables preview URLs, and a + gate on the production hostname alone would leave that one public). It also runs when wrangler + fails, because wrangler can fail after the version is live. An optional preview alias + (`alias: report-2026-08`) is checked after its upload. Each check probes the site root and one + real non-HTML file from the build, so a gate on the entry point alone cannot pass. The output + URLs are constructed from inputs, never parsed from wrangler's output; only the version + preview URL, which is probed but never output, comes from wrangler's version ID. The action does not create Workers or provision Access: an admin creates and gates each Worker once, and the deploy token is account-owned with Editor on that one Worker, so it cannot create an ungated Worker either. It takes the lessons of #105 for itself. wrangler is pinned exactly and installed with @@ -30,7 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **CI**: four `deploy-cloudflare` harness jobs, none needing a Cloudflare account. `dc-gate-probe` runs the probe against a local stand-in (`.github/fixtures/access-gate/`) for every response shape. `dc-refuses-ungated` asserts that a Worker which does not exist is refused - before wrangler is even installed. `dc-inputs` asserts that every invalid input fails in + before wrangler is even installed, with a positive control showing the same inputs reach + wrangler once the gate is off. `dc-inputs` asserts that every invalid input fails in validation, including #163's own example alias `2026-08`, which Cloudflare rejects because aliases must start with a letter. `dc-wrangler-config` dry-runs the generated config through the pinned wrangler, which is what a Dependabot bump of the lockfile is tested against. A real deploy diff --git a/TESTING.md b/TESTING.md index b353420..bd2c052 100644 --- a/TESTING.md +++ b/TESTING.md @@ -34,7 +34,7 @@ The container fixture at `containers/quantecon/tests/minimal-jupyter-book/` also | `setup-environment` | Standard-mode conda cache, two-run missβ†’hit chain (the #33/#78 path, previously never confirmed by CI) | | `build-lectures` | Real HTML build of the fixture on the cache-restored conda env, executed-cell output asserted; plus the negative direction β€” a page whose code cell raises must fail the step, so a regression that swallows the build status cannot pass silently | | `build-jupyter-cache` | Smoke build + outputs, then a full round-trip into `restore-jupyter-cache` for both cache types. ⚠️ Its internal `setup-environment`/`build-lectures` calls run `@v0`, not the PR β€” GitHub forbids expressions in `uses:`, so that chain is untestable pre-release by construction (see #100) | -| `deploy-cloudflare` | Everything short of a real deploy: the Access gate probe against a local stand-in for every response shape (exact team domain passes; wrong org, public `2xx`, same-host redirect, missing `Location`, `404`, `5xx`, unreachable, and a public asset behind a gated root all fail); the action refusing an ungated Worker **before wrangler is even installed**, asserted on the filesystem; every invalid input failing in validation; and the pinned wrangler accepting the generated config (`--dry-run` deploy and alias upload), which is what a Dependabot bump of the lockfile runs against. ❌ A real deploy needs a gated Worker and a token, so the first consumer deploy is its only proof | +| `deploy-cloudflare` | Everything short of a real deploy: the Access gate probe against a local stand-in for every response shape (exact team domain passes; wrong org, public `2xx`, same-host redirect, missing `Location`, a `Location` hiding its host behind userinfo, `404`, `5xx`, unreachable, an empty team domain, and a public asset behind a gated root all fail); the action refusing an ungated Worker **before wrangler is even installed**, asserted on the filesystem, with a positive control proving the same inputs reach wrangler once the gate is off; every invalid input failing in validation, with the gate off so a dropped rule cannot hide behind it; and the pinned wrangler accepting the generated config (`--dry-run` deploy and alias upload, with no `Unexpected fields` warning), which is what a Dependabot bump of the lockfile runs against. ❌ A real deploy needs a gated Worker and a token, so the first consumer deploy is its only proof | | `publish-gh-pages`, `preview-netlify`, `preview-cloudflare` | ❌ Not covered β€” need real deploy targets and secrets; owned by the post-release canary repo (stage 2+ of #100) | --- diff --git a/deploy-cloudflare/README.md b/deploy-cloudflare/README.md index 41eda80..b93ed5a 100644 --- a/deploy-cloudflare/README.md +++ b/deploy-cloudflare/README.md @@ -7,7 +7,7 @@ GitHub Pages stays the route for everything public ([`publish-gh-pages`](../publ ## Features - πŸ”’ **Proves the gate before uploading.** If an anonymous request to the Worker is not redirected to your Access team's login, nothing is uploaded. That refuses a Worker that does not exist, one that is public, and one gated by the wrong Access organisation. -- πŸ” **Proves it again after deploying**, on the site root and on one real file from the build, so a site that is silently public fails the job instead of passing it. +- πŸ” **Proves it again after deploying**, on production and on the new version's own preview URL, each at the site root and at one real file from the build. A site that is silently public fails the job instead of passing it. - πŸ—‚οΈ **Optional preview alias**, for example `report-2026-08`: a permanent URL for this build alongside the moving production URL. The alias is gate-checked too. - πŸ“Œ **Pinned wrangler**, installed with `npm ci` from a committed lockfile and kept current by Dependabot. - πŸ“ **Job summary.** On `push`, `schedule` and `workflow_dispatch` there is no PR to comment on, so the result (including "refused" or "deployed but not gated") goes to the job summary. @@ -87,9 +87,9 @@ A monthly report that also keeps a permanent URL per month: | `team-domain` | The Access team's login domain, `.cloudflareaccess.com` (a bare `` is accepted) | Yes | - | | `build-dir` | Directory with the built site | Yes | - | | `alias` | Also upload this build as a named preview alias. Lowercase letters, digits and dashes, **starting with a letter** (`report-2026-08`, not `2026-08`), and `-` must fit in 63 characters | No | `''` | -| `require-access` | Check the gate before and after deploying. `false` skips both checks, with a warning. Never set it for private content | No | `true` | +| `require-access` | Check the gate before uploading, after deploying (production and the new version's preview URL) and on the alias. `false` skips every check, with a warning. Never set it for private content | No | `true` | -The URLs are **constructed** from `worker-name`, `account-subdomain` and `alias`, never parsed from wrangler's output, following the same approach as `preview-cloudflare` (#131). +The output URLs are **constructed** from `worker-name`, `account-subdomain` and `alias`, never parsed from wrangler's output, following the same approach as `preview-cloudflare` (#131). The one address read from wrangler's output is the new version's preview URL, which is only probed and never handed out. ## Outputs @@ -106,6 +106,7 @@ The check is [`scripts/check-access-gate.sh`](../scripts/check-access-gate.sh), |----------|---------| | `301/302/303/307/308` to exactly `team-domain` | βœ… gated | | Redirect to a different `*.cloudflareaccess.com` | ❌ gated by the **wrong Access organisation** | +| Redirect whose `Location` carries userinfo or a backslash | ❌ the real host is ambiguous, and Access never sends one | | `2xx` | ❌ **the site is public** | | `404` | ❌ no Worker answers on that hostname, or its `workers.dev` route is off | | Anything else, or unreachable | ❌ the gate could not be verified. The check fails closed | @@ -115,8 +116,8 @@ Every check probes the site root **and one non-HTML file from `build-dir`** (the The action runs the check at three points: 1. **Before uploading.** This is prevention. Deploying content first and turning Access on afterwards would leave private data on a public hostname for the length of the setup. -2. **After deploying.** This is a regression guard. The pilot showed Access survives a redeploy, but the check is one request, and it guards against a private site silently going public. -3. **After the alias upload.** Preview URLs can be gated separately from production, so the alias gets its own check. +2. **After deploying**, on production and on the new version's own preview URL. For production this is a regression guard: the pilot showed Access survives a redeploy, but the check is one request, and it guards against a private site silently going public. The preview URL is checked for the first time here. Every deploy gets one, `https://-{worker}.{subdomain}.workers.dev`, because the config enables preview URLs, and an Access setup that covers only the production hostname would leave it public. Its address comes from the `Current Version ID` line in wrangler's output; if that line is missing, the check fails rather than being skipped. The check also runs when `wrangler deploy` fails, because wrangler can exit with an error after the new version is already live. +3. **After the alias upload.** The alias is one more preview URL, so it gets its own check. You can run the same check by hand: @@ -163,7 +164,7 @@ The Access application is one-time per Worker, and the identity provider is one- ## Notes - **Custom domains** are a per-Worker setting in the dashboard, and the Worker's Access application picks them up automatically. The action does not manage domains: its generated config declares no routes, so a deploy leaves dashboard-attached domains alone, and it always checks the `workers.dev` URL. -- **The generated config** ([`write-config.js`](write-config.js)) sets the name, a fixed `compatibility_date`, `assets.directory`, `workers_dev: true` and `preview_urls: true`. It is written to `RUNNER_TEMP` for each run, so consumer repositories need no wrangler config. wrangler running in CI overwrites settings changed in the dashboard (such as the placeholder's script) without prompting. +- **The generated config** ([`write-config.js`](write-config.js)) sets the name, a fixed `compatibility_date`, `assets.directory`, `workers_dev: true` and `preview_urls: true`. It is written to `RUNNER_TEMP` for each run, so consumer repositories need no wrangler config. `preview_urls: true` turns preview URLs on for the Worker at every deploy, even if they were turned off in the dashboard; the check after deploying covers the new version's preview URL for that reason. wrangler running in CI overwrites settings changed in the dashboard (such as the placeholder's script) without prompting. Dotfiles in `build-dir` (Sphinx's `.buildinfo`, for example) are uploaded like any other file unless listed in a `.assetsignore`. - **A blank page after access is granted.** On the first load after access is granted or restored, cached Access redirects for `style.css`, `app.js` and data files can be served in place of the real assets. A plain refresh fixes it. - **A user added to the team after being denied** may stay denied until they revoke the OAuth app in their GitHub settings and log in again. This is documented Cloudflare behaviour, though it did not reproduce on the path the pilot tested. - **Limits.** Workers static assets allow 20,000 files and 25 MiB per file per version on the free plan (100,000 files on paid). The 1,000 most recent preview aliases are kept per Worker. Lecture-sized Jupyter Books are a few thousand files. @@ -176,15 +177,21 @@ Nothing was uploaded. The line above it says why: - **`answered 404`**: no Worker by that name under that `account-subdomain`, or its `workers.dev` route is off. Check both, and create the Worker first if it is new. - **`THE SITE IS PUBLIC`**: Access is off for the Worker, or set to *Previews only*. Turn it on with *All traffic*. - **`wrong Access organisation`**: the Worker's Access application belongs to a different Zero Trust team, or `team-domain` is wrong. +- **`not to the Access login domain`**: the site redirected somewhere other than `team-domain`, or sent no `Location`, so Access is not answering for this hostname. Check that Access is on with *All traffic* and that `team-domain` is right. +- **`expected a redirect to the Access login domain`**: an unexpected status such as `401`, `403` or `5xx`. Check the Worker in the dashboard, then re-run the job. - **`could not be reached`**: a network problem between the runner and Cloudflare. Re-run the job. ### "wrangler deploy failed" -wrangler's own error is printed above the annotation. An authentication or permission error usually means the token lacks Editor on this Worker, the account ID is wrong, or the token has expired. +wrangler's own error is printed above the annotation. An authentication or permission error usually means the token lacks Editor on this Worker, the account ID is wrong, or the token has expired. wrangler can fail after the new version is already live, so the job summary reports the gate check that ran after the failure. -### "The new build is deployed but … is NOT behind Access" +### "A hostname serving this Worker is NOT behind Access" -This is the urgent one: the content is live and anonymous requests are not being redirected. Turn Access on (*All traffic*) for the Worker, or disable its `workers.dev` route, then re-run the job to confirm. +This is the urgent one: the new build is live, or may be, and anonymous requests to production or to the new version's preview URL are not being redirected. The `FAIL` line above it names the hostname. Turn Access on for the Worker with *All traffic*, which covers production and every preview URL, or disable its `workers.dev` route. Then re-run the job to confirm. + +### "wrangler deployed but its output named no 'Current Version ID'" + +The deploy went through, but the new version's preview URL could not be worked out, so it was not checked. That usually means a wrangler upgrade changed its output. Check the preview URL by hand with `scripts/check-access-gate.sh`, and report it here. ### "The alias is uploaded but … is NOT behind Access" diff --git a/deploy-cloudflare/action.yml b/deploy-cloudflare/action.yml index bab4f8d..de75265 100644 --- a/deploy-cloudflare/action.yml +++ b/deploy-cloudflare/action.yml @@ -43,9 +43,10 @@ inputs: default: '' require-access: description: >- - Prove the site is gated: before uploading, and again after, an + Prove the site is gated: before uploading, after deploying (production + and the new version's preview URL) and on the alias after its upload, an unauthenticated request must be redirected to team-domain. `false` skips - both checks and should never be used for private content. + every one of these checks and should never be used for private content. required: false default: 'true' @@ -108,6 +109,8 @@ runs: *) fail "require-access must be 'true' or 'false', got [$REQUIRE_ACCESS]." ;; esac + # A newline would inject keys into GITHUB_OUTPUT below. + [[ "$BUILD_DIR" != *$'\n'* && "$BUILD_DIR" != *$'\r'* ]] || fail "build-dir must not contain line breaks." [ -d "$BUILD_DIR" ] || fail "build-dir [$BUILD_DIR] is not a directory." BUILD_DIR=$(cd "$BUILD_DIR" && pwd -P) [ -n "$(find "$BUILD_DIR" -type f -print -quit)" ] || fail "build-dir [$BUILD_DIR] contains no files." @@ -116,15 +119,19 @@ runs: # One real non-HTML file to probe besides the root, so a gate that # covers only the document root cannot pass (the pilot's # data/latest.json check). Deterministic, URL-safe paths only, so no - # encoding is needed; dotfiles and wrangler's own control files are - # skipped because they are never served. `awk` reads to the end rather - # than exiting early, which under pipefail would fail on sort's SIGPIPE. + # encoding is needed. Dotfiles and the _headers/_redirects/_worker.js + # names are skipped to keep the choice predictable: wrangler does not + # serve the control files, and a gated site redirects every path + # anyway. `awk` reads to the end rather than exiting early, which under + # pipefail would fail on sort's SIGPIPE. probe_path=$(cd "$BUILD_DIR" && find . -type f ! -path '*/.*' ! -iname '*.html' ! -iname '*.htm' \ ! -name '_headers' ! -name '_redirects' ! -name '_worker.js' -print \ | LC_ALL=C sort \ | awk '!found && /^\.\/[A-Za-z0-9._~\/-]+$/ { print substr($0, 2); found = 1 }' || true) deploy_url="https://${WORKER_NAME}.${subdomain}.workers.dev" + # Every version and alias is served at -..workers.dev. + preview_suffix="-${WORKER_NAME}.${subdomain}.workers.dev" alias_url="" [ -z "$ALIAS" ] || alias_url="https://${ALIAS}-${WORKER_NAME}.${subdomain}.workers.dev" @@ -133,6 +140,7 @@ runs: echo "build-dir=$BUILD_DIR" echo "probe-path=$probe_path" echo "deploy-url=$deploy_url" + echo "preview-suffix=$preview_suffix" echo "alias-url=$alias_url" } >> "$GITHUB_OUTPUT" @@ -223,9 +231,9 @@ runs: cat "$CONFIG" echo "path=$CONFIG" >> "$GITHUB_OUTPUT" - # wrangler runs uncaptured, so its errors reach the log as they happen. - # #105 is what capturing into a variable under pipefail does: the step - # aborts at the assignment and the output is never printed. + # wrangler's output is teed, never captured into a variable, so its errors + # reach the log as they happen. #105 is what capturing under pipefail does: + # the step aborts at the assignment and the output is never printed. - name: Deploy to production id: deploy shell: bash @@ -236,36 +244,62 @@ runs: CI: 'true' WRANGLER: ${{ steps.wrangler.outputs.bin }} CONFIG: ${{ steps.config.outputs.path }} + LOG: ${{ steps.wrangler.outputs.dir }}/${{ inputs.worker-name }}.deploy.log DEPLOY_URL: ${{ steps.inputs.outputs.deploy-url }} + PREVIEW_SUFFIX: ${{ steps.inputs.outputs.preview-suffix }} run: | set -uo pipefail message="${GITHUB_REPOSITORY}@${GITHUB_SHA:0:7} run ${GITHUB_RUN_ID}"; message=${message:0:100} - if ! "$WRANGLER" deploy --config "$CONFIG" --message "$message"; then - echo "::error::wrangler deploy failed; see its output above. A permissions error usually means the token lacks Editor on this Worker." + "$WRANGLER" deploy --config "$CONFIG" --message "$message" 2>&1 | tee "$LOG" + status=${PIPESTATUS[0]} + + # preview_urls: true gives every version its own preview URL, + # https://-..workers.dev, + # which the check below must cover too. Read from the log, unlike the + # URLs this action hands out, because it is only ever probed: if the + # line is missing the check fails closed rather than skipping it. + version=$(sed -n 's/.*Current Version ID: \([0-9a-f]\{8\}\)[0-9a-f-]*.*/\1/p' "$LOG" | tail -n 1) + [ -z "$version" ] || echo "version-preview-url=https://${version}${PREVIEW_SUFFIX}" >> "$GITHUB_OUTPUT" + + if [ "$status" -ne 0 ]; then + echo "::error::wrangler deploy failed (exit $status); see its output above. It can fail after the new version is already live, so the gate is checked anyway. A permissions error usually means the token lacks Editor on this Worker." exit 1 fi echo "deploy-url=$DEPLOY_URL" >> "$GITHUB_OUTPUT" echo "βœ… Deployed $DEPLOY_URL" - # A regression guard: the pilot showed Access survives a redeploy, and the - # check before deploying already proved the gate. It stays because it is - # one request and the failure it guards is a private site gone public. + # A regression guard for production (the pilot showed Access survives a + # redeploy, and the check before deploying already proved it), and the only + # check of the new version's own preview URL, which a gate on the production + # hostname alone would leave public. It also runs when wrangler failed, + # because wrangler can exit non-zero after the new version is already live. - name: Check the Access gate after deploying id: gate-after - if: inputs.require-access == 'true' + if: ${{ !cancelled() && inputs.require-access == 'true' && steps.gate-before.outcome == 'success' && (steps.deploy.outcome == 'success' || steps.deploy.outcome == 'failure') }} shell: bash env: TEAM: ${{ steps.inputs.outputs.team-domain }} URL: ${{ steps.inputs.outputs.deploy-url }} PROBE_PATH: ${{ steps.inputs.outputs.probe-path }} + DEPLOY: ${{ steps.deploy.outcome }} + VERSION_URL: ${{ steps.deploy.outputs.version-preview-url }} run: | set -uo pipefail + failed=0 urls=("$URL/") [ -z "$PROBE_PATH" ] || urls+=("$URL$PROBE_PATH") + if [ -n "$VERSION_URL" ]; then + urls+=("$VERSION_URL/") + [ -z "$PROBE_PATH" ] || urls+=("$VERSION_URL$PROBE_PATH") + elif [ "$DEPLOY" = "success" ]; then + echo "::error::wrangler deployed but its output named no 'Current Version ID', so the new version's preview URL could not be checked." + failed=1 + fi if ! bash "$GITHUB_ACTION_PATH/../scripts/check-access-gate.sh" "$TEAM" "${urls[@]}"; then - echo "::error::The new build is deployed but $URL is NOT behind Access for $TEAM. Treat the site as public until this is fixed: turn Access on (All traffic) for the Worker, or disable its workers.dev route." - exit 1 + echo "::error::A hostname serving this Worker is NOT behind Access for $TEAM (see above). Treat the site as public until this is fixed: turn Access on for the Worker with All traffic, which also covers its preview URLs, or disable its workers.dev route." + failed=1 fi + exit "$failed" - name: Upload preview alias id: alias @@ -324,6 +358,7 @@ runs: INPUTS: ${{ steps.inputs.outcome }} GATE_BEFORE: ${{ steps.gate-before.outcome }} DEPLOY: ${{ steps.deploy.outcome }} + VERSION_URL: ${{ steps.deploy.outputs.version-preview-url }} GATE_AFTER: ${{ steps.gate-after.outcome }} ALIAS: ${{ steps.alias.outcome }} GATE_ALIAS: ${{ steps.gate-alias.outcome }} @@ -331,7 +366,7 @@ runs: gate() { case "$1" in success) echo "βœ… redirects to \`$TEAM\`" ;; - failure) echo "🚨 **NOT GATED**, treat as public" ;; + failure) echo "🚨 **not proven gated**, treat as public" ;; *) [ "$REQUIRE_ACCESS" = "true" ] && echo "not checked" || echo "⚠️ not checked (\`require-access: false\`)" ;; esac } @@ -342,12 +377,17 @@ runs: echo "❌ Inputs rejected, nothing was deployed. See the step log." elif [ "$GATE_BEFORE" = "failure" ]; then echo "β›” **Refused.** $DEPLOY_URL is not behind Access for \`$TEAM\`, so nothing was uploaded." + elif [ "$DEPLOY" = "failure" ]; then + echo "❌ **wrangler deploy failed.** The new build may already be live; see the step log." + echo + echo "Production gate after the failure: $(gate "$GATE_AFTER")" elif [ "$DEPLOY" != "success" ]; then - echo "❌ The deploy did not complete. See the wrangler output in the step log." + echo "❌ The deploy did not run. See the step log." else echo "| | URL | Access gate |" echo "|---|---|---|" echo "| Production | $DEPLOY_URL | $(gate "$GATE_AFTER") |" + [ -z "$VERSION_URL" ] || echo "| This version | $VERSION_URL | $(gate "$GATE_AFTER") |" if [ "$ALIAS" = "success" ]; then echo "| Alias | $ALIAS_URL | $(gate "$GATE_ALIAS") |" elif [ "$ALIAS" = "failure" ]; then diff --git a/scripts/check-access-gate.sh b/scripts/check-access-gate.sh index 7bfd3cf..daff7ca 100755 --- a/scripts/check-access-gate.sh +++ b/scripts/check-access-gate.sh @@ -32,8 +32,14 @@ if [ "$#" -lt 2 ]; then exit 2 fi -team=$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]') +raw_team=$1 +team=$(printf '%s' "$raw_team" | tr '[:upper:]' '[:lower:]') shift +# An empty team would equal the empty host of a redirect with no Location. +if ! [[ "$team" =~ ^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.cloudflareaccess\.com$ ]]; then + echo "usage: team-domain must be .cloudflareaccess.com, got [$raw_team]" >&2 + exit 2 +fi failed=0 for url in "$@"; do @@ -51,11 +57,15 @@ for url in "$@"; do case "$code" in 301|302|303|307|308) - host=${location#*://} - host=${host%%/*} - host=${host##*@} - host=${host%%:*} - host=$(printf '%s' "$host" | tr '[:upper:]' '[:lower:]') + authority=${location#*://} + authority=$(printf '%s' "${authority%%[/?#]*}" | tr '[:upper:]' '[:lower:]') + # Userinfo or a backslash makes the real host ambiguous (browsers read + # `\` as `/`, so https://x.com\@team... goes to x.com). Access never + # sends either, so refuse rather than guess. + case "$authority" in + *@*|*\\*) host="" ;; + *) host=${authority%%:*} ;; + esac if [ "$host" = "$team" ]; then echo "PASS $code -> $host $url" elif [[ "$host" == *.cloudflareaccess.com ]]; then From 1dff9f00b77f3d31cb7850593eaed359c45e6fc5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 23 Sep 2026 17:03:45 +0000 Subject: [PATCH 4/4] fix(deploy-cloudflare): keep -e from ending the deploy step at the wrangler pipeline (#163) From a second review of the fix commit: - The runner starts steps with `bash -e`, so a failing `wrangler deploy | tee` ended the step before the exit status, the version id and the ::error:: annotation were read. The pipeline now runs under `set +e`. - A missing "Current Version ID" now fails the check after deploying in every case, not only after a successful deploy: wrangler prints the id only once every post-upload step has succeeded, so most failed deploys lack it, and the version's preview URL was then skipped silently. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JxLZgJNNxNmNmeUUiD3SBW --- deploy-cloudflare/README.md | 4 ++-- deploy-cloudflare/action.yml | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/deploy-cloudflare/README.md b/deploy-cloudflare/README.md index b93ed5a..ca5cf1d 100644 --- a/deploy-cloudflare/README.md +++ b/deploy-cloudflare/README.md @@ -189,9 +189,9 @@ wrangler's own error is printed above the annotation. An authentication or permi This is the urgent one: the new build is live, or may be, and anonymous requests to production or to the new version's preview URL are not being redirected. The `FAIL` line above it names the hostname. Turn Access on for the Worker with *All traffic*, which covers production and every preview URL, or disable its `workers.dev` route. Then re-run the job to confirm. -### "wrangler deployed but its output named no 'Current Version ID'" +### "wrangler's output named no 'Current Version ID'" -The deploy went through, but the new version's preview URL could not be worked out, so it was not checked. That usually means a wrangler upgrade changed its output. Check the preview URL by hand with `scripts/check-access-gate.sh`, and report it here. +The new version's preview URL could not be worked out, so it was not checked, and the check fails. wrangler prints the ID only once every step after the upload has succeeded, so this follows most `wrangler deploy` failures; after a successful deploy it means a wrangler upgrade changed its output. Check the preview URL by hand with `scripts/check-access-gate.sh`, using the version ID from the dashboard. ### "The alias is uploaded but … is NOT behind Access" diff --git a/deploy-cloudflare/action.yml b/deploy-cloudflare/action.yml index de75265..0425b11 100644 --- a/deploy-cloudflare/action.yml +++ b/deploy-cloudflare/action.yml @@ -250,8 +250,12 @@ runs: run: | set -uo pipefail message="${GITHUB_REPOSITORY}@${GITHUB_SHA:0:7} run ${GITHUB_RUN_ID}"; message=${message:0:100} + # The runner starts this script with `bash -e`, which would end it at a + # failing pipeline, before the status and version id are read. + set +e "$WRANGLER" deploy --config "$CONFIG" --message "$message" 2>&1 | tee "$LOG" status=${PIPESTATUS[0]} + set -e # preview_urls: true gives every version its own preview URL, # https://-..workers.dev, @@ -291,8 +295,10 @@ runs: if [ -n "$VERSION_URL" ]; then urls+=("$VERSION_URL/") [ -z "$PROBE_PATH" ] || urls+=("$VERSION_URL$PROBE_PATH") - elif [ "$DEPLOY" = "success" ]; then - echo "::error::wrangler deployed but its output named no 'Current Version ID', so the new version's preview URL could not be checked." + else + # wrangler prints the id only after every post-upload step succeeds, + # so a deploy that failed after going live usually lacks it too. + echo "::error::wrangler's output named no 'Current Version ID', so the new version's preview URL could not be checked. Treat it as public until verified by hand with scripts/check-access-gate.sh." failed=1 fi if ! bash "$GITHUB_ACTION_PATH/../scripts/check-access-gate.sh" "$TEAM" "${urls[@]}"; then