Skip to content

Add support for multiple clients#201

Merged
aurel-fr merged 5 commits into
mainfrom
support-multiple-apps
May 26, 2026
Merged

Add support for multiple clients#201
aurel-fr merged 5 commits into
mainfrom
support-multiple-apps

Conversation

@ketzusaka
Copy link
Copy Markdown
Contributor

As part of Project Prism we are expanding the apps and will need them all to be able to add backup methods. This updates the backup service to respect the client name when determining the appropriate bundle identifiers for verification.

I've added this header to all of the routes for completeness, but add_factor is the primary one we're interested in right now.

@ketzusaka ketzusaka force-pushed the support-multiple-apps branch 4 times, most recently from d8529d8 to 90b43df Compare May 22, 2026 20:18
As part of Project Prism we are expanding the apps and will need them all to be able to add backup methods. This updates the backup service to respect the client name when determining the appropriate bundle identifiers for verification.

I've added this header to all of the routes for completeness, but add_factor is the primary one we're interested in right now.
@ketzusaka ketzusaka force-pushed the support-multiple-apps branch from 90b43df to 375b6b0 Compare May 22, 2026 20:24
@ketzusaka ketzusaka marked this pull request as ready for review May 22, 2026 21:02
@aurel-fr aurel-fr requested a review from Copilot May 22, 2026 21:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the backup service’s OIDC token verification to support multiple client applications by selecting the expected Google/Apple audience based on an incoming client-name request header, and threads this through route handlers into the auth/verification layer.

Changes:

  • Add client-name/client-version header constants and plumb client-name through relevant routes into AuthHandler and OidcTokenVerifier.
  • Select Google/Apple OIDC client IDs dynamically based on client-name, with unit tests covering the mapping logic.
  • Update cargo-deny advisory ignores and bump rustls-webpki in Cargo.lock (alongside existing 0.101.7 usage).

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/types/environment.rs Adds client-name-based selection for Google/Apple OIDC client IDs and unit tests.
src/routes/verify_factor.rs Extracts client-name/client-version via constants and forwards client-name into auth verification.
src/routes/sync_backup.rs Extracts and forwards client-name into auth verification.
src/routes/retrieve_metadata.rs Extracts and forwards client-name into auth verification.
src/routes/retrieve_from_challenge.rs Extracts client-name/client-version via constants and forwards client-name into auth verification.
src/routes/delete_factor.rs Extracts and forwards client-name into auth verification.
src/routes/delete_backup.rs Extracts and forwards client-name into auth verification.
src/routes/create_backup.rs Extracts and forwards client-name into factor registration validation.
src/routes/add_sync_factor.rs Extracts and forwards client-name into factor registration validation.
src/routes/add_factor.rs Extracts and forwards client-name into new-factor registration validation.
src/oidc_token_verifier.rs Accepts client-name to choose expected audience during OIDC verification; refactors verifier creation.
src/lib.rs Exposes new headers module.
src/headers.rs Defines header-name constants for reuse across routes.
src/auth.rs Threads client_name through auth verification and OIDC validation paths.
deny.toml Adds additional ignored RUSTSEC advisories for rustls-webpki via upstream deps.
Cargo.lock Updates rustls-webpki (0.103.10 → 0.103.13) while retaining 0.101.7 via rustls 0.21.x.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/oidc_token_verifier.rs Outdated
Comment thread src/types/environment.rs Outdated
aurel-fr and others added 4 commits May 22, 2026 15:04
Google backup is okay. Just need android-id in here so apple backup can be implemented on android devices down the road
Comment thread src/types/environment.rs
Comment on lines +274 to +275
(Self::Staging, Some("ios-id")) => "org.world.staging.id",
(Self::Staging, Some("android-id")) => "org.world.id.staging",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it expected for the id to before and after staging?

Copy link
Copy Markdown
Contributor Author

@ketzusaka ketzusaka May 22, 2026

Choose a reason for hiding this comment

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

Yeah this was one oddity where each team used a different bundle id format :(

@aurel-fr
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 12 comments.

Comments suppressed due to low confidence (1)

src/routes/delete_factor.rs:67

  • client_name is borrowed from headers and then passed into an async call (auth_handler.verify(...).await). Borrowing from HeaderMap across await commonly fails to compile (self-referential future). Copy the header to an owned String first and pass as_deref()/Option<String> onward.
    let client_name = headers.get(&CLIENT_NAME).and_then(|v| v.to_str().ok());
    // Step 1: Extract the factor IDs from the request
    let factor_id = request.factor_id.clone();
    let encryption_key = request.encryption_key.clone();

    // Step 1.1 Validate there is no encryption key if deleting a `Sync` factor
    if request.scope == FactorScope::Sync && encryption_key.is_some() {

Comment thread src/routes/verify_factor.rs
Comment thread src/routes/retrieve_from_challenge.rs
Comment thread src/routes/delete_backup.rs
Comment thread src/routes/create_backup.rs
Comment thread src/routes/sync_backup.rs
Comment thread src/routes/add_factor.rs
Comment thread src/auth.rs
Comment thread src/auth.rs
Comment thread src/oidc_token_verifier.rs
Comment thread src/types/environment.rs
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aurel-fr aurel-fr merged commit ee951d3 into main May 26, 2026
12 checks passed
@aurel-fr aurel-fr deleted the support-multiple-apps branch May 26, 2026 19:53
@github-actions github-actions Bot mentioned this pull request May 26, 2026
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.

4 participants