Skip to content

Conversation

@adelrodriguez
Copy link
Collaborator

@adelrodriguez adelrodriguez commented Feb 1, 2026

Greptile Overview

Greptile Summary

This PR extracts the hardcoded trustedOrigins: ["init://"] into a configurable AUTH_TRUSTED_ORIGINS environment variable with comprehensive regex-based parsing for HTTP/HTTPS origins, wildcard subdomains, and custom URL schemes.

Key changes:

  • Removed hardcoded init:// from auth/options.ts
  • Added AUTH_TRUSTED_ORIGINS env var with CSV parsing and pattern matching
  • Passes env value to createAuth() configuration

Critical issue:

  • AUTH_TRUSTED_ORIGINS is required but has no default value. When the environment variable is unset, the app will fail at runtime during env parsing. Since mobile authentication requires the init:// scheme (per AndroidManifest.xml:27), the default should include this value to prevent breaking existing functionality.

Confidence Score: 2/5

  • This PR will break mobile authentication and fail at runtime when AUTH_TRUSTED_ORIGINS is unset
  • The missing default value for a required environment variable creates a breaking change that will cause immediate runtime failures in environments where AUTH_TRUSTED_ORIGINS is not explicitly configured
  • packages/env/src/presets.ts requires a default value to prevent runtime failures

Important Files Changed

Filename Overview
packages/env/src/presets.ts Added AUTH_TRUSTED_ORIGINS env var with comprehensive validation but missing .optional() or default value, causing runtime failures when unset
packages/backend/src/functions/shared/auth/index.ts Added trustedOrigins: env.AUTH_TRUSTED_ORIGINS to auth config, may pass undefined when env var unset

Sequence Diagram

sequenceDiagram
    participant EnvFile as Environment
    participant PresetFn as auth preset function
    participant Backend as Backend env module
    participant AuthSetup as convexAuth function
    
    EnvFile->>PresetFn: Read AUTH_TRUSTED_ORIGINS
    PresetFn->>PresetFn: Transform CSV to array
    PresetFn->>PresetFn: Check regex patterns
    PresetFn->>Backend: Provide processed value
    Backend->>AuthSetup: Pass trustedOrigins config
    AuthSetup->>AuthSetup: Configure CORS checking
Loading

@adelrodriguez adelrodriguez marked this pull request as ready for review February 1, 2026 19:21
@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat_add_trusted_origins_configuration_for_auth

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Collaborator Author

adelrodriguez commented Feb 1, 2026

Copy link

@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.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@adelrodriguez adelrodriguez force-pushed the refactor_improve_logger_initialization_and_configuration branch from dec9aab to dff01d7 Compare February 1, 2026 19:29
@adelrodriguez adelrodriguez force-pushed the feat_add_trusted_origins_configuration_for_auth branch from 4b16b54 to 5fa792a Compare February 1, 2026 19:29
Base automatically changed from refactor_improve_logger_initialization_and_configuration to main February 1, 2026 19:44
@adelrodriguez adelrodriguez force-pushed the feat_add_trusted_origins_configuration_for_auth branch from 5fa792a to f1df8e8 Compare February 1, 2026 19:44
Copy link

@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.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@adelrodriguez adelrodriguez force-pushed the feat_add_trusted_origins_configuration_for_auth branch from f1df8e8 to 7828f80 Compare February 1, 2026 19:48
Copy link

@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.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@adelrodriguez adelrodriguez force-pushed the feat_add_trusted_origins_configuration_for_auth branch from 7828f80 to 6e2cad4 Compare February 1, 2026 20:08
Copy link

@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.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@adelrodriguez adelrodriguez merged commit 7b9c1cc into main Feb 1, 2026
9 checks passed
@adelrodriguez adelrodriguez deleted the feat_add_trusted_origins_configuration_for_auth branch February 1, 2026 20:13
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.

2 participants