Diffinery

homeflare/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

Homeflare: read the /login page before matching it

setup.sh's last check piped curl into grep -q, which stops at the first
match; under pipefail curl then fails to finish writing (curl: (23)
Failed writing body) and the check fails though the page is right.
0001-homeflare.patch is regenerated from this branch, so it matches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bot authored 1 parent 05b48e2commit f3a502c7467b0a04f131588ec96e3b8e1032bb8eBrowse files
2 files changed+12−5
modified0001-homeflare.patch+8−4View file
@@ -233,7 +233,7 @@
233233
234234 if ! listed=$(wrangler containers images list --json --filter "(^|/)$name\$" 2>&1); then
235235 diff --git a/scripts/setup.sh b/scripts/setup.sh
236-index 7989e5c..8d87fe1 100755
236+index 7989e5c..1db5aea 100755
237237 --- a/scripts/setup.sh
238238 +++ b/scripts/setup.sh
239239 @@ -19,6 +19,12 @@
@@ -308,7 +308,7 @@
308308 step "Finishing the Access setup (first deploy)"
309309 : >"$OUTPUTS"
310310 GITHUB_OUTPUT="$OUTPUTS" "$ROOT/scripts/bootstrap.sh"
311-@@ -237,12 +252,18 @@ for _ in $(seq 1 30); do
311+@@ -237,12 +252,21 @@ for _ in $(seq 1 30); do
312312 [[ "$code" == 200 ]] && break
313313 sleep 10
314314 done
@@ -319,7 +319,11 @@
319319 + [[ "$code" == 200 ]] || die "https://$DIFFINERY_DOMAIN/healthz did not return 200 (last: ${code:-no answer}). Check that $DIFFINERY_DOMAIN resolves to the host serving $CF_API and that the Worker started."
320320 +fi
321321 info "/healthz -> 200"
322- curl -sS "https://$DIFFINERY_DOMAIN/login" | grep -q "Sign in with a passkey" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc"
322+-curl -sS "https://$DIFFINERY_DOMAIN/login" | grep -q "Sign in with a passkey" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc"
323++# Read the whole page before matching: `curl | grep -q` fails under pipefail when grep stops
324++# early and curl can't finish writing (curl: (23) Failed writing body).
325++LOGIN_PAGE="$(curl -sS "https://$DIFFINERY_DOMAIN/login" || true)"
326++grep -q "Sign in with a passkey" <<<"$LOGIN_PAGE" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc"
323327 info "/login serves the passkey sign-in page"
324328 loc="$(curl -sS -o /dev/null -w '%{http_code} %{redirect_url}' "https://$DIFFINERY_DOMAIN/auth/access" || true)"
325329 -if [[ "$loc" == 302\ https://*.cloudflareaccess.com/* ]]; then
@@ -329,7 +333,7 @@
329333 info "/auth/access is behind Cloudflare Access"
330334 else
331335 warn "/auth/access is not behind Cloudflare Access yet ($loc), so email recovery and the first admin sign-in won't work. Set ACCESS_TEAM_DOMAIN and run this again."
332-@@ -252,4 +273,4 @@ echo
336+@@ -252,4 +276,4 @@ echo
333337 echo "Diffinery is live at https://$DIFFINERY_DOMAIN."
334338 echo "Sign in as the first administrator at https://$DIFFINERY_DOMAIN/auth/access with an email in BOOTSTRAP_ADMINS,"
335339 echo "then add a passkey. Run scripts/setup.sh again at any time to update."
modifiedscripts/setup.sh+4−1View file
@@ -258,7 +258,10 @@
258258 [[ "$code" == 200 ]] || die "https://$DIFFINERY_DOMAIN/healthz did not return 200 (last: ${code:-no answer}). Check that $DIFFINERY_DOMAIN resolves to the host serving $CF_API and that the Worker started."
259259 fi
260260 info "/healthz -> 200"
261-curl -sS "https://$DIFFINERY_DOMAIN/login" | grep -q "Sign in with a passkey" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc"
261+# Read the whole page before matching: `curl | grep -q` fails under pipefail when grep stops
262+# early and curl can't finish writing (curl: (23) Failed writing body).
263+LOGIN_PAGE="$(curl -sS "https://$DIFFINERY_DOMAIN/login" || true)"
264+grep -q "Sign in with a passkey" <<<"$LOGIN_PAGE" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc"
262265 info "/login serves the passkey sign-in page"
263266 loc="$(curl -sS -o /dev/null -w '%{http_code} %{redirect_url}' "https://$DIFFINERY_DOMAIN/auth/access" || true)"
264267 if ((ON_CLOUDFLARE == 0)); then