Skip to content

Add GitHub sign-in and enclave release verification - #47

Merged
adrianvrj merged 3 commits into
mainfrom
github-login
Oct 28, 2026
Merged

adrianvrj merged 3 commits into
mainfrom
github-login

Conversation

@adrianvrj

@adrianvrj adrianvrj commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Enclave release verification

  • An attested PCR0 that is not in the pinned list is accepted when {backendUrl}/api/enclave/releases/{pcr0} serves a Sigstore v0.3 bundle that verifies with @freedomofpress/sigstore-browser 0.1.15 (exact pin; unaudited) against the bundled public-good trusted root (one TUF refresh on failure, then fail closed), signed by GitHub Actions for repo id 1333734222 / owner id 216094156, workflow .github/workflows/release.yml on a refs/tags/vN push, github-hosted runner; whose in-toto statement names PCR0/1/2 equal to the attestation, version N ≥ minVersion and an unexpired expiresAt. All-zero PCR0 is rejected.
  • Pinned pcr0 stays for strict integrators and for the currently deployed unsigned image (7f32a8…, f388b0…).
  • Tests: 504 passed, 2 skipped. Size: about +16.5 KB per entry; the vault IIFE +97 KB.
  • Requires Serve enclave release bundles to the SDK cavos#317.

Summary

  • CavosAuth.getGitHubOAuthUrl(): keeps a login secret and a PKCE verifier in sessionStorage, asks the backend for the authorize URL, and refuses it unless it goes to https://github.com/login/oauth/authorize with this login's code_challenge and S256. A code issued without our challenge could otherwise be redeemed without this browser.
  • handleCallback: when the exchange returns github_grant, runs verify_github inside the attested enclave and uses the returned token exactly like a Google id_token: login binding, registry bearer and social recovery credential.
  • Email and GitHub share one private enclaveLogin helper; email behaviour and messages are unchanged.
  • github added to Identity.provider, the social recovery providers, requiresLoginBinding and providerFromClaims.
  • Modal: "Continue with GitHub" when providers includes 'github'. The default providers are unchanged. React Native does not offer GitHub, since it cannot verify enclave attestations (same as email).

Before merge

Merging to main publishes to npm. Wait for the enclave deploy (cavos-labs/cavos-recovery#11) and add its PCR0 to src/recovery/attestationDefaults.ts first.

Test plan

  • npm test: 465 passed, 2 skipped (16 new)
  • tsc --noEmit, npm run build
  • Authorize URL without code_challenge throws, against the real backend
  • End to end in a local app

🤖 Generated with Claude Code

getGitHubOAuthUrl starts a PKCE login and refuses an authorization URL that
does not carry this login's challenge. handleCallback trades the GitHub
grant inside the attested enclave for a token bound to the login secret,
used like a Google id_token. The modal offers "Continue with GitHub" when
'github' is in providers.
The SDK no longer needs a new version for every enclave deploy. An
attested PCR0 that is not pinned is accepted when the backend serves a
Sigstore bundle, signed by the cavos-recovery release workflow on a vN tag
and logged in Rekor, whose statement names the same PCR0, PCR1 and PCR2,
a version at or above the SDK's minimum and an expiry in the future. The
pinned PCR0 list remains for strict integrators and the images deployed
before signed releases.
@adrianvrj adrianvrj changed the title Add GitHub sign-in Add GitHub sign-in and enclave release verification Oct 28, 2026
@adrianvrj
adrianvrj marked this pull request as ready for review October 28, 2026 20:45
@adrianvrj
adrianvrj merged commit 2cb7dcf into main Oct 28, 2026
2 checks passed
@adrianvrj
adrianvrj deleted the github-login branch October 28, 2026 20:45
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