Repository navigation
Conversation
A WebRTC login now signs in with Google through Firebase Auth, in place of
the emailed link. One consent gives the Firebase session and the pk_token, a
Google ID token whose nonce commits to the key bundle of the user. keys/{email}
holds the bundle, the pk_token, nonce_rnd and a signature by the identity key
of the bundle. A peer checks all of them before it pins a bundle, so the
admins of the project cannot swap one.
Firebase accepts a pk_token as a sign-in until it expires, so a client
publishes its record one hour after the consent. A record of other keys is
never replaced. A peer whose record fails its check is skipped, and sync
raises the failure at its end. syft now declares pyjwt>=2.9.0 and
cryptography.
A Google ID token signs anyone in to Firebase until it expires. So a key record that held it waited one hour before it went out. The client now replaces Google's RSA signature with a GQ signature, a zero-knowledge proof that Google signed the token. Peers check the proof with Google's key, but Firebase refuses the token as a sign-in. So a client publishes its record at once, and the raw ID token never reaches disk. A peer record fails its check, for example once Google retires the key that signed it. Login now prints such peers and returns the client. add_peer and approve_peer_request finish the peering before they raise. sync() raises background WebRTC errors with the bundle errors, so neither hides the other. syft pins pyjwt>=2.8.0.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #9654: the base branch is
pjwerneck/webrtc-signaling-server.webrtc=Truefor the first time on a machine, Firebase previously sent a sign-in link to the email. Now the login prints the address of a Google consent page. The user signs in with the Google account of the email, then pastes the address of thehttp://localhostpage that does not load. One consent gives the Firebase session and a Google ID token whose nonce commits to the key bundle of the user.login,login_doandlogin_dsAPIs do not change. The plan of feat: sync over WebRTC with Firebase signaling and no Google login (WIP) #9654 had "no Google account in WebRTC mode"; this PR changes that.keys/{email}, and peers kept any value they found there. Nowkeys/{email}holds a key record: the bundle, the pk_token,nonce_rnd, andsig.sigis an Ed25519 signature over the pk_token by the identity key of the bundle.GoogleOpenPubkeyAttestorchecks the GQ signature with Google's keys, the issuer, the audience, the email andemail_verified, the nonce, andsig. A bundle that fails a check is not kept, and the error names the check.sync()raisesUnprovenKeyBundleErrorat the end of its pass, with any background WebRTC error.add_peerandapprove_peer_requestfinish the peering, then raise. A login prints the peers and returns the client.syft/sync/connections/webrtc/firebase/gq.pymakes and checks GQ signatures for RS256 tokens.database.rules.jsonaccepts only a record with the four string fields atkeys/{email}.infra/firebase/README.mdhas the console steps for the sign-in with Google.pyjwt>=2.8.0andcryptography>=38.0.3. Both were already installed throughgoogle-auth[pyjwt].Guidelines
High level
Mid level
Low level
Security
keys/{email}, so the admins of the project could swap a bundle. Now a peer keeps a bundle only if a Google-signed token commits to it, and the identity key of the bundle signed that token. An admin cannot make Google's signature, so an admin cannot swap a bundle.keys/. So the published pk_token has a GQ signature, a zero-knowledge proof of Google's signature. Firebase refuses it as a sign-in.infra/firebase/README.mdexplains this.Testing
tests/unit/webrtc/test_gq.py. A GQ token proves the signature of the issuer, and PyJWT refuses it as an RS256 token. Another payload, a truncated signature, or a token of another signer is refused.tests/unit/webrtc/test_key_attestation.py): one test for each failed check, plus an expired token and a token issued ahead of the local clock, which are accepted. Other unit tests cover the attestation file, the peering config, and an unproven peer bundle in sync, login andadd_peer.tests/integration/webrtc/cover the login with a stand-in for Google, and thekeys/rules. They also cover a bundle that a project admin swaps, a record published at once, and a record of other keys that is not replaced. The job flow of a DO and a DS runs from end to end.createAuthUriputs our nonce in the Google ID token. In a live test on two machines, a DO with a Google Workspace account and a DS with a Gmail account logged in withencryption=True. Both records went out at once. Their GQ signatures passed the attestor against Google's real keys. Each side kept the bundle of the other, and an encrypted job ran.webrtc-transport-for-pysyft. The clients of feat: sync over WebRTC with Firebase signaling and no Google login (WIP) #9654 write a bundle string atkeys/{email}, so these rules refuse theiradd_peerthere.Asana task
https://app.asana.com/1/1185126988600652/project/1220031667339032/task/1219404478719095