Skip to content

Append services to apple external oauth#32

Merged
AnthonyRonning merged 2 commits intomasterfrom
apple-external-oauth2-services
May 20, 2025
Merged

Append services to apple external oauth#32
AnthonyRonning merged 2 commits intomasterfrom
apple-external-oauth2-services

Conversation

@AnthonyRonning
Copy link
Copy Markdown
Contributor

@AnthonyRonning AnthonyRonning commented May 20, 2025

Summary by CodeRabbit

  • New Features
    • Added new entries to device history logs, providing updated PCR hash values and timestamps.
  • Bug Fixes
    • Improved handling of Apple OAuth client ID to ensure compatibility with web-based OAuth flows.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2025

Walkthrough

A new record was appended to both the PCR device and production history JSON files, reflecting updated PCR hash values and timestamps. In the OAuth callback flow for Apple sign-in, the client ID is now checked and, if necessary, modified to ensure it ends with ".services", with a debug log added to capture this adjustment.

Changes

File(s) Change Summary
pcrDevHistory.json, pcrProdHistory.json Appended a new record to each JSON array with updated PCR0, PCR1, PCR2 values, timestamp, and signature. No existing data was altered.
src/web/oauth_routes.rs Modified Apple OAuth callback logic to ensure client ID ends with ".services" and added a debug log when changed. No public APIs altered.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WebApp
    participant AppleOAuth

    User->>WebApp: Initiate Apple OAuth callback
    WebApp->>WebApp: Retrieve client_id from settings
    WebApp->>WebApp: If client_id does not end with ".services", append ".services"
    WebApp->>WebApp: Log debug message if modified
    WebApp->>AppleOAuth: Continue OAuth flow with (possibly modified) client_id
    AppleOAuth-->>WebApp: Respond with authentication result
    WebApp-->>User: Complete sign-in process
Loading

Poem

In the land of hashes, a new record appears,
PCRs updated, with fresh digital cheers.
Apple OAuth now sports a ".services" tail,
Ensuring sign-ins never fail.
A bunny logs changes, with ears held high—
Hopping through history, under the OAuth sky!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 5120402 and 2f8d06f.

⛔ Files ignored due to path filters (2)
  • pcrDev.json is excluded by !pcrDev.json
  • pcrProd.json is excluded by !pcrProd.json
📒 Files selected for processing (3)
  • pcrDevHistory.json (1 hunks)
  • pcrProdHistory.json (1 hunks)
  • src/web/oauth_routes.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 100000ms (1)
  • GitHub Check: Development Reproducible Build
🔇 Additional comments (3)
pcrProdHistory.json (1)

36-42: Verified new PCR entry

The new entry follows the expected structure and format, maintaining consistency with previous records. The timestamp (1747766237) is sequential to the previous entry, and all hash values follow the expected hexadecimal format.

pcrDevHistory.json (1)

36-42: Confirmed synchronized PCR history update

The new PCR entry for the development environment properly maintains the expected data structure and format. The timestamp (1747766223) is correctly sequential and slightly earlier than the production entry, which is consistent with a typical deployment flow.

src/web/oauth_routes.rs (1)

479-492: Good implementation to ensure Apple web OAuth flows use a Services ID

The changes correctly modify the Apple client ID to append ".services" if it's not already present, which is required by Apple for web-based OAuth flows. The added debug log is helpful for troubleshooting.

This change ensures compatibility with Apple's requirements for web authentication without disrupting existing functionality.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch apple-external-oauth2-services
  • Post Copyable Unit Tests in Comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR modifies the Apple OAuth implementation to append '.services' to client IDs for web-based authentication flows, ensuring compatibility with Apple's authentication requirements.

  • Added logic in src/web/oauth_routes.rs to dynamically append '.services' to Apple client IDs for web flows
  • Updated PCR measurements in pcrProd.json and pcrDev.json to reflect OAuth configuration changes
  • Added new PCR measurement entries in history files with timestamps 1747766237 (prod) and 1747766223 (dev)
  • Maintained PCR1 constant across all updates while modifying PCR0 and PCR2 to reflect application changes

5 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment thread src/web/oauth_routes.rs
Comment on lines +489 to +492
if !client_id.ends_with(".services") {
client_id = format!("{}.services", client_id);
debug!("Modified Apple client ID for web flow: {}", client_id);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

style: Consider adding validation to ensure client_id is not empty before appending .services

Suggested change
if !client_id.ends_with(".services") {
client_id = format!("{}.services", client_id);
debug!("Modified Apple client ID for web flow: {}", client_id);
}
if !client_id.is_empty() && !client_id.ends_with(".services") {
client_id = format!("{}.services", client_id);
debug!("Modified Apple client ID for web flow: {}", client_id);
} else if client_id.is_empty() {
error!("Empty Apple client ID");
return Err(ApiError::BadRequest);
}

@AnthonyRonning AnthonyRonning merged commit db40038 into master May 20, 2025
8 checks passed
@AnthonyRonning AnthonyRonning deleted the apple-external-oauth2-services branch May 20, 2025 19:15
@coderabbitai coderabbitai Bot mentioned this pull request May 30, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Sep 15, 2025
Closed
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