Skip to content

test(dev): live ceremonies for GitHub, X and Google from the dev app - #72

Open
SupremaLex wants to merge 8 commits into
mainfrom
feat/e2e-bind
Open

SupremaLex wants to merge 8 commits into
mainfrom
feat/e2e-bind

Conversation

@SupremaLex

@SupremaLex SupremaLex commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Live end-to-end tests that prove real GitHub, X and Google identities from the dev app's UI, against the real platforms, notary and Bridge. No chain is involved.

What it adds

  • Live specs in ts/apps/dev/e2e/, run with pnpm --filter @libid/dev test:live (playwright.live.config.ts). The config starts the dev app's own stack (pnpm dev), clicks the platform in the UI, drives the popup through the platform's sign-in and consent, and checks the run is accepted for the expected platform and account. Proof contents are left to @libid/ceremony, which validates them before the app sees accepted.
  • Platform drivers:
    • github.ts signs in with username, password and TOTP, one code per 30-second step and each submitted once;
    • x.ts and google.ts restore a saved session and only consent;
    • popup.ts drives the popup and notices its return to the Bridge, or the app's own failure.
  • Settings (settings.ts): the same variable names as libid-server-rs' ceremony-tests, so one .env.test serves both suites. LIBID_LIVE_PLATFORMS lists the platforms to prove, and each one listed must have its variables. The README has the table.
  • Dev app:
    • local.ts holds the app, Bridge and notary origins;
    • services.ts refuses to start when the stack's ports are already in use.
  • Secrets stay out of the stack: the stack gets an allowlisted environment, so the build, Bridge, notary and CCDP never see the test accounts' secrets.

Google's session: a manual first step

Google challenges a saved session used from an address other than the one it was signed in from. It also refuses sign-in in an automated browser. So CI never signs in to Google; it reuses a session a person made:

  1. Open the proxy CI uses on your machine with an SSM port-forward (aws ssm start-session … AWS-StartPortForwardingSession).
  2. Sign in to the test account by hand, in plain Chrome with a fresh profile and --proxy-server pointing at that tunnel.
  3. Close Chrome and export the profile's session with node e2e/export-session.ts <profile> google.json.
  4. Put google.json in the Secrets Manager secret libid-live-e2e/google-test-alice-session in the proxy's account, and delete the file and the profile.

Steps are in ts/apps/dev/README.md ("Google's session"). After that the job keeps the session fresh: each passing run writes the cookies Google refreshed back to the secret (GOOGLE_TEST_ALICE_COOKIES_OUT), and a failed run writes nothing. Redo the steps only when the job reports an expired session, or when the proxy's address changes. X's session is made the same way, signed in by hand in plain Chrome and exported with the same script, but without the proxy: X does not tie a session to an address. GitHub signs in on every run with username, password and TOTP.

CI (.github/workflows/live-e2e.yml)

Not a required check.

  • When: it runs daily, on dispatch, and on same-repository pull requests touching the dev app, its packages or the workflow. Fork and Dependabot PRs are excluded.
  • GitHub and X job: runs on a GitHub-hosted runner.
  • Google job: runs only on main, and only while LIBID_GOOGLE_RUNNER=ssm. It assumes LIBID_GOOGLE_PROXY_ROLE over OIDC, opens an SSM port-forward to a Squid proxy on an EC2 instance (LIBID_GOOGLE_PROXY_INSTANCE) with no inbound ports, and sends the browser through it, so Google sees the address the session was signed in from. The same role reads and writes the session secret; cookie values are masked in the job log.
  • Concurrency: each test account has its own concurrency group, so two runs never submit the same TOTP code.
  • On failure: a job prints the end of the stack log to the job log, where GitHub masks the secrets, and uploads the screenshots.

The proxy, the role and the session secret are defined in grndd-systems/deployment#167 (grndd-testnet). The workflow needs only the two variables, the role's OIDC trust and the secret's fixed name.

Verified

  • The GitHub and X job is green on this branch.
  • The Google job passed through the proxy before the session moved to Secrets Manager (run 39938543539, sandbox account). GitHub's identity notarization took 5–10.6 s on runners, which is why it needed fix(ceremony): give a notarized request 30 seconds #165's 30-second budget.
  • Locally, typecheck, lint, format, the unit tests, the dev mock suite and actionlint pass. A save-and-reload of a Google session with real Chromium keeps only Google's cookies and writes the file with mode 600.
  • A probe in grndd-testnet has reused one session from the NAT address daily since 2026-10-19, storing refreshed cookies back each run, and is still signed in on 2026-10-26.

Status and open work

This branch is a working base, not final. Before merge:

  • Not yet run: the Google job's Secrets Manager read and write-back. The job only runs on main, so test it on a fork with the same variables, or after the secret exists.
  • Infrastructure: grndd-systems/deployment#167 applied, the session signed in through the new proxy and put in the secret, then LIBID_GOOGLE_PROXY_ROLE and LIBID_GOOGLE_PROXY_INSTANCE pointed at its outputs. Until then the variables point at a sandbox account that has no session secret, so the Google job would fail on main.
  • Repository secret GOOGLE_TEST_ALICE_COOKIES is no longer used by CI and can be deleted once the secret is seeded.

For whoever edits this next

  • Map: ceremony.live.spec.ts (the three tests) → github.ts / x.ts / google.ts (one popup driver each) → popup.ts (shared driving loop) and session.ts (load, restore, save cookies). settings.ts owns variable names; the README table must match it. playwright.live.config.ts starts the stack with an allowlisted environment.
  • Keep as is: stealth.js is vendored and stays byte-identical. The stack never receives test secrets. One concurrency group per test account.
  • Stand-alone: the suite needs nothing from libid-bridge-rs' unmerged live suite. stealth.js came from it and is kept byte-identical; session.ts still reads that suite's snake_case cookie exports, so an existing X_TEST_ALICE_COOKIES keeps working.
  • Google rules: never automate the Google sign-in itself, and never work around its detection. A login page means the session expired; renew it by hand.

Known limits

  • person.ts gives the X and Google browser a desktop user agent and installs stealth.js for the whole context, so the app and prover pages run with it too.
  • A partitioned cookie's cross-site flag is not restored, because Playwright's public API cannot express it.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://feat-e2e-bind.previews.lib.id, https://feat-e2e-bind-libid.grounded-systems.workers.dev (commit 9aecb55)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://dcc213b4.previews.lib.id, https://dcc213b4-libid.grounded-systems.workers.dev 9aecb55 2026-11-15T13:10:35.866Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://9fb5cb68.previews.lib.id, https://9fb5cb68-libid.grounded-systems.workers.dev d3d0f35 2026-10-22T16:26:53.403Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://4276c645.previews.lib.id, https://4276c645-libid.grounded-systems.workers.dev b802eea 2026-10-19T16:55:50.656Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://5d795c04.previews.lib.id, https://5d795c04-libid.grounded-systems.workers.dev 7bf9e06 2026-10-19T14:43:11.557Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://d52e8c8a.previews.lib.id, https://d52e8c8a-libid.grounded-systems.workers.dev 4b2f2c9 2026-10-05T10:03:06.055Z Visit the dashboard ↗

@SupremaLex SupremaLex changed the title test(bind): end-to-end GitHub binding from UI to chain test(bind): live end-to-end binding for GitHub, X and Google, from UI to chain Oct 6, 2026
SupremaLex added a commit that referenced this pull request Oct 22, 2026
…ull requests

Lets PR #72 test the route before merge; reverted before merge, with the proxy role's pull-request trust.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
@SupremaLex SupremaLex changed the title test(bind): live end-to-end binding for GitHub, X and Google, from UI to chain test(dev): live ceremonies for GitHub, X and Google from the dev app Oct 23, 2026
@SupremaLex
SupremaLex marked this pull request as ready for review October 23, 2026 15:49
local.ts holds the app, Bridge and notary origins and the app's port; the app, vite config and mock suite read them. services.ts refuses to start when a stack port is already taken.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
settings.ts reads the variables libid-server-rs' ceremony-tests uses, from the environment or LIBID_TEST_ENV_FILE. session.ts loads a saved X or Google session (base64 JSON or a file), restores it into a browser context, and saves Google's refreshed cookies. export-session.ts exports a Chrome profile signed in by hand.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
github.ts signs in with username, password and TOTP, one code per 30-second step, each submitted once. x.ts and google.ts consent on a restored session and fail with the reason when the platform asks for a person. popup.ts drives a popup until it returns to the Bridge or the app fails. person.ts presents a desktop browser with the vendored stealth.js, kept byte-identical and out of lint.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
playwright.live.config.ts starts the dev app's stack with an allowlisted environment, so it never sees the test secrets. ceremony.live.spec.ts proves each listed platform through the app's UI and checks the run is accepted for the expected account.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
…ached proxy

GitHub and X run on a hosted runner. Google runs on main only: the job assumes an OIDC role, port-forwards over SSM to a Squid proxy whose address the session was signed in from, reads the session from Secrets Manager and stores it back refreshed after a pass.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
How to run the live tests, the settings table, CI behaviour, and the hand sign-in that makes Google's session.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
…m the Rust suite

X's saved session is now signed in by hand in plain Chrome and exported with
the same script as Google's, so the live tests no longer need the Rust
suite's `ceremony export x`. Comments and the README no longer point at that
suite's code; the TOTP test cites RFC 6238, its vector recomputed with
Python's hmac. stealth.js is unchanged.

Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>
@SupremaLex
SupremaLex requested a review from xgreenx October 28, 2026 15:36
Assisted-by: Claude Opus 5.5
Signed-off-by: SupremaLex <georglutsenko@gmail.com>

This branch has not been deployed

No deployments
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