Skip to content

ci(pages): deploy the testnet build to its own site, testnet-forge.dashhq.org - #678

Merged
PastaPastaPasta merged 2 commits into
masterfrom
launch/testnet-site
Nov 24, 2026
Merged

PastaPastaPasta merged 2 commits into
masterfrom
launch/testnet-site

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

When forge.dashhq.org moves to mainnet at launch, testnet users need a site. GitHub Pages serves only one custom domain per repository, so the testnet build can't share this repo's Pages site.

  • .github/workflows/pages-testnet.yml builds forge-web for testnet with NEXT_PUBLIC_SITE_URL=https://testnet-forge.dashhq.org.
    • It attests the build manifest the same way pages.yml does, so the app's verify check and dg verify-app work there.
    • It pushes the export to the gh-pages branch of a site repo (TESTNET_SITE_REPO, default PastaPastaPasta/dash-forge-testnet-site) with a deploy key, writing CNAME and .nojekyll.
    • Old _next/static chunks are kept so tabs that are already open don't break.
    • It keeps the static chunks of the last three deploys and prunes older ones (Pages' 1 GB limit). It pins GitHub's SSH host key and runs pages.yml's export checks.
  • Its gateway, notify and site-switch settings are separate variables (TESTNET_SITE_*).
    • It runs only when the repo variable TESTNET_SITE_ENABLED=true (set). The deploy key is a secret of the testnet-site environment, which allows master only, and only the deploy job enters it. Merging pushes the first build to the site repo. The site goes live once its Pages source/custom domain and the testnet-forge DNS CNAME exist (runbook step 1 / P1).
  • Passkey vault: testnet-forge.dashhq.org is accepted as its own relying party. The "open Forge's address" hint now names the build's own SITE_URL. A test pins that testnet.forge.dashhq.org is refused.
    • The host is deliberately a sibling of forge.dashhq.org, not a child. A page on a child host is allowed by WebAuthn to request rpId: forge.dashhq.org, so a compromised testnet site could ask for mainnet passkey PRF outputs.
    • A sibling one-level name also matches the existing git-forge.dashhq.org convention.

Verified: pnpm vitest run lib/auth/passkey-vault gives 72 passed, and the YAML parses. The end-to-end deploy runs after the site repo, deploy key and DNS exist; those steps are in docs/launch/mainnet-runbook.md.

🤖 Generated with Claude Code

…shhq.org

When forge.dashhq.org moves to mainnet, testnet needs a home. GitHub Pages
serves one custom domain per repository, so pages-testnet.yml builds
forge-web for testnet and pushes it to a site repository's gh-pages branch
(keeping old _next/static chunks for open tabs), attesting the manifest like
pages.yml. It deploys nothing until TESTNET_SITE_DEPLOY_KEY is set.

The passkey vault accepts testnet-forge.dashhq.org as its own relying party.
The host is a sibling of forge.dashhq.org on purpose: a child host could ask
the browser for forge.dashhq.org's passkeys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84844435-865d-46bc-a3ee-462c4e0c225b
Commits

Reviewing files that changed from the base of the PR and between b5917e6 and 576707e.

Files selected for processing: 4

  • .github/workflows/pages-testnet.yml
  • docs/guides/verify-the-app.md
  • forge-web/lib/auth/passkey-vault/policy.test.ts
  • forge-web/lib/auth/passkey-vault/policy.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: changes requested

Two medium items should land before TESTNET_SITE_DEPLOY_KEY is set. Neither one breaks the build or the skip path. Everything else below is low or a nit.

What I checked and found correct

  • Skip path: with the secret unset, build runs only the enabled step, prints a notice and passes. attest and deploy are skipped because their if: is false, and success() is still implied. Nothing fails.
  • Non-master refs: attest and deploy both check github.ref == 'refs/heads/master', and deploy needs attest. A dispatch from a branch or a tag builds and deploys nothing. This only holds while the workflow file itself is the one on master; see M2.
  • Dotfiles: upload-artifact v7 with include-hidden-files: true keeps out/.well-known/. download-artifact v8 extracts the tree as it was, cp -R site/. dest/ copies dotfiles, and .nojekyll stops Jekyll dropping _next/ and .well-known/. The build checks test -s out/.well-known/security.txt before the upload. The manifest grep matches too: build-manifest.mjs writes JSON.stringify(m, null, 1), which gives "network": "testnet".
  • Deploy skew: the logic is right. It removes everything at the top level except .git and _next, removes everything in _next/ except static/, then copies the new build over it. Names are hashed, so nothing of the new build is shadowed. Growth is a separate problem; see M3.
  • Secret handling: the key only ever goes into an env var and a 0600 file and is never echoed. The enabled step reads it before checkout, so no npm code ever sees it in its environment. The deploy job inherits only contents: read, and it needs no write access through GITHUB_TOKEN.
  • Missing build env: compared with pages.yml, the only gap is NEXT_PUBLIC_CF_BEACON_TOKEN, and leaving it out is fine as long as Cloudflare doesn't inject a beacon on this host (N2). The DEVNET_* variables don't apply to a testnet build.
  • Passkey RP: accepting testnet-forge.dashhq.org is safe. It and forge.dashhq.org are siblings, and neither is a registrable suffix of the other, so neither can claim the other's RP id. The parent dashhq.org is still refused, and the new "child of forge.dashhq.org" test pins the dangerous shape.
  • SITE_URL import: fine. lib/site.ts imports nothing, so there is no import cycle, and SITE_URL is a pure constant built from build-time env, so it is safe under SSR.
  • Tests: pnpm install --frozen-lockfile && pnpm vitest run lib/auth/passkey-vault in a clean worktree gave 72 passed and 1 skipped (the live test).
  • actionlint: clean except SC2034 (i unused) at .github/workflows/pages-testnet.yml:177. Use for _ in ….

Findings

M1 (medium): dg verify-app fails on the new site by default.
.github/workflows/pages-testnet.yml:124 signs the attestation with the workflow .github/workflows/pages-testnet.yml. But dg verify-app's default expected signer is PastaPastaPasta/dash-forge/.github/workflows/pages.yml (crates/dg/src/attestation_signer.rs:18, crates/dg/src/verify_app.rs:93). The docs give the same default (docs/guides/verify-the-app.md:136), including the gh attestation verify … --signer-workflow …/pages.yml command.

So dg verify-app https://testnet-forge.dashhq.org exits with E504 ("signed by …/pages-testnet.yml"). Only --signer-workflow PastaPastaPasta/dash-forge/.github/workflows/pages-testnet.yml makes it pass.

The in-app check (forge-web/lib/build-check.ts) does pass. It accepts any attestation in this repo, so it doesn't catch the mismatch.

Fix, either way:

  • (a) Make dg accept both official deploy workflows by default (pages.yml and pages-testnet.yml on refs/heads/master), or choose the default by host.
  • (b) At least document --signer-workflow …/pages-testnet.yml and the matching gh attestation verify command for testnet-forge.dashhq.org in verify-the-app.md.

M2 (medium, security): the deploy key isn't limited to master the way the Pages deploy is.
pages.yml deploys through the github-pages environment, whose branch policy is what restricts deploys to master. Here, TESTNET_SITE_DEPLOY_KEY is a plain repository secret (.github/workflows/pages-testnet.yml:53, :139). The github.ref checks only bind the copy of the workflow file on master.

Anyone with write access can push a branch whose copy of the workflow drops those checks (or just prints the key) and run it with workflow_dispatch or on: push. That puts arbitrary code on testnet-forge.dashhq.org. That origin now holds a passkey-vault RP and signing keys, and the bypass gets around master's branch protection.

Fix:

  1. Create an environment (say testnet-site) whose deployment branches are master only, and store the key there.
  2. Add environment: testnet-site to the deploy job.
  3. The build job runs npm code, so keep it outside that environment. Drive the skip from a repository variable such as TESTNET_SITE_ENABLED, or from a cheap gate job that uses the environment and only checks whether the secret is set.

M3 (medium, not urgent): _next/static on gh-pages grows without bound.
.github/workflows/pages-testnet.yml:157-158 never deletes anything under _next/static. Each deploy whose chunks change adds files (the wasm SDK alone is tens of MB whenever it changes), and they stay forever. GitHub Pages refuses to publish a site over 1 GB, and the repo keeps growing too.

pages.yml bounds this: it keeps two older generations and stops at MAX_SITE_MB=700.

Fix: clone with --depth 3. Read git show HEAD:forge-manifest.json and HEAD~1:forge-manifest.json; the manifest lists every _next/static/… file of its build. Then delete any file under dest/_next/static that neither manifest nor the new build lists. That keeps the same two-generation skew window as pages.yml.

L1 (low): an unauthenticated ssh-keyscan decides which github.com host key the deploy trusts.
At .github/workflows/pages-testnet.yml:147, whatever host key answers the scan is trusted on first use. Hosted runners already ship GitHub's keys in /etc/ssh/ssh_known_hosts. Pin them instead: either -o UserKnownHostsFile=/etc/ssh/ssh_known_hosts, or write GitHub's published ed25519 line (github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl).

L2 (low): on a self-hosted build, the passkey message sends users to the page they are already on.
forge-web/lib/auth/passkey-vault/policy.ts:48 now says "open ${SITE_URL}". Take a self-hosted build with NEXT_PUBLIC_SITE_URL=https://example.org (docs/hosting.md asks self-hosters to set it). There passkeyVaultRpId is null, so the message says "open https://example.org" to a user who is already on example.org.

Fix: name SITE_URL only when SITE_HOST is in PASSKEY_VAULT_RP_IDS. Otherwise name the official host for the build's network: testnet → testnet-forge, mainnet → forge.

L3 (low): fewer export and live checks than pages.yml.
The testnet workflow leaves out several checks pages.yml has:

  • the Contact: and Expires: checks on security.txt, and the check that the manifest lists it
  • the license-notice checks (third-party-licenses.txt, licenses/*)
  • the live security.txt check after the deploy

Also, nothing checks site/.well-known/security.txt after download-artifact. Copy those steps over and add test -s site/.well-known/security.txt before the push.

Nits (none block):

  • N1: NEXT_PUBLIC_MAINNET_SITE_URL and NEXT_PUBLIC_TESTNET_SITE_URL (.github/workflows/pages-testnet.yml:86-87) aren't read anywhere in forge-web. The header says they're shared with pages.yml, which doesn't set them. Drop them, or land the code that reads them. They don't change the bytes, since Next inlines only the variables it references.
  • N2: the build carries no CF beacon. If testnet-forge.dashhq.org is proxied by Cloudflare and Web Analytics automatic setup is ever enabled for it, dg verify-app will fail, because it removes an injected tag only next to the build's own beacon. Keep automatic injection off for this host, or add a TESTNET_SITE_CF_BEACON_TOKEN variable.
  • N3: docs/launch/mainnet-runbook.md is referenced at lines 4 and 58 but doesn't exist on master or in this PR.
  • N4: some text still names only forge.dashhq.org:
    • public/.well-known/security.txt has Canonical: https://forge.dashhq.org/…
    • components/ui/trust-panel.tsx:179 calls only forge.dashhq.org "GitHub Pages, behind Cloudflare"
    • components/username-hint.tsx:31 hardcodes forge.dashhq.org
  • N5 (migration, not this PR's code): existing testnet passkey-vault users made their passkeys with RP forge.dashhq.org, and their IndexedDB is on that origin. On testnet-forge they need another way to sign in, and they have to enroll again. Worth a line in the launch notes.

🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

…; prune old chunks

The deploy key moves to the testnet-site environment (deployments from master
only), entered only by the deploy job, so a workflow edited on a branch never
sees it; TESTNET_SITE_ENABLED turns the workflow on. The site keeps the static
chunks of the last three deploys and prunes the rest (Pages' 1 GB limit),
pins GitHub's SSH host key, and runs pages.yml's export checks. verify-the-app
names the --signer-workflow for the testnet site. The passkey hint names the
build's own host only when it is a passkey host.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: approve

Re-review at 576707e. M1–M3 and L1–L3 from the previous review are fixed. Nothing below blocks the merge.

What I checked

  • Environment: testnet-site has a single branch_policy rule, with custom branch policies set to exactly one: master (type branch). TESTNET_SITE_DEPLOY_KEY exists only as an environment secret; there is no repo-level copy. Only the deploy job enters the environment, and it is also gated on github.ref == 'refs/heads/master'. A workflow edited on a branch or in a PR can't get the key. TESTNET_SITE_ENABLED=true is set at repo level.
  • Host key: the pinned key matches gh api meta ssh_keys and has fingerprint SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU, GitHub's published ed25519 key. StrictHostKeyChecking=yes and IdentitiesOnly=yes are set.
  • Manifest format: in the live https://forge.dashhq.org/forge-manifest.json, files is an object keyed by relative paths with no leading /, for example _next/static/chunks/103-….js. scripts/build-manifest.mjs lists every file in out/ except the manifest itself, so the current build's _next/static files are always in the keep set. The "network": "testnet" grep matches JSON.stringify(…, null, 1) output.
  • Prune logic (pages-testnet.yml:155-170): I replayed it in /work/scratch with jq-built manifests over deploys A→B→C→D→D2.
    • After D it keeps exactly B, C and D, and the shared chunks survive.
    • sort, sort -u and comm all run under LC_ALL=C, so their orders agree. Mixed-case names prune correctly.
    • No set -e traps: every conditional is an if, nothing uses a bare &&, comm exits 0 under pipefail, and find -delete implies -depth, so nested empty directories go.
    • A wrong key or network failure in ls-remote falls through to git init. The push is then a non-fast-forward without force, so it can't clobber the site.
  • dg: ExpectedSigner::parse accepts PastaPastaPasta/dash-forge/.github/workflows/pages-testnet.yml. The name_ok check allows -, and the default signer stays pages.yml, so a testnet manifest served on forge.dashhq.org still fails the default check. lib/build-check.ts only checks that some attestation exists in the repo, so the in-app check also works for testnet.
  • Passkey policy: the PASSKEY_VAULT_RP_IDS change is sound. testnet-forge.dashhq.org is a sibling host, the test pins that testnet.forge.dashhq.org is refused, and officialSite() falls back to forge.dashhq.org for self-hosted builds. new URL(SITE_URL) adds no new way to fail, because site.ts already parses it at import.
  • actionlint 1.7.7 is clean on pages-testnet.yml.

Findings

  1. Low: the runbook reference is wrong, and the owner steps for the testnet site aren't written down anywhere.

    • Where: .github/workflows/pages-testnet.yml:3 and the PR body.
    • Problem: both cite docs/launch/mainnet-runbook.md, which doesn't exist; the runbook is docs/mainnet-runbook.md, and it doesn't mention the testnet site at all. Pages isn't set up on PastaPastaPasta/dash-forge-testnet-site yet (GET /pages returns 404, and the repo is empty).
    • Fix: correct the path, and add the remaining owner steps to the runbook:
      • set the Pages source to gh-pages with custom domain testnet-forge.dashhq.org and enforce HTTPS;
      • add the DNS CNAME testnet-forge → pastapastapasta.github.io;
      • record the deploy key and the testnet-site environment as done.
  2. Low: the PR description is out of date about what a merge does.

    • Problem: it says that until the secret exists the workflow "deploys nothing, so merging this changes nothing yet". The key and TESTNET_SITE_ENABLED=true both exist now, and the workflow file is in paths. Merging will push to the site repo straight away. That push is harmless, but the "Check the live site" step will warn until Pages and DNS are set up.
    • Fix: update the description. It should also mention TESTNET_SITE_ENABLED, the environment and the officialSite() hint.
  3. Low: the shared-origin hint still sends testnet users to mainnet. This is the same kind of problem as the previous L2.

Nits

  • Re-running a deploy shortens the skew window (pages-testnet.yml:157-158). Re-running the same build, or redeploying the same manifest, still rotates .deploys. Replayed: re-running D2 dropped C and kept only D and D2. It also makes a commit, so the "no change" path is never reached. Fix: skip the rotation when cmp -s site/forge-manifest.json dest/forge-manifest.json.
  • The gh-pages history grows without limit. The tree is now bounded, but every deploy commits its new chunks on top of a shallow clone. Each SDK bump adds a new wasm_sdk_bg.*.wasm of about 26.5 MB, and GitHub recommends keeping a Pages source repository under 1 GB. Fix: publish each deploy as a single orphan commit and force-push, since the history has no use.
  • Concurrency isn't per ref (concurrency.group: pages-testnet). A build-only workflow_dispatch on a feature branch cancels a master deploy that is in progress. No harm is done, because the push is atomic and the next master push redeploys. A ${{ github.ref }} suffix avoids it.
  • No unit test covers the officialSite() hint text in passkeyVaultProblem.

🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

@PastaPastaPasta
PastaPastaPasta merged commit d582ba2 into master Nov 24, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant