Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughReplaced a framework-specific test-environment check with a Node.js NODE_ENV-based check in the OAuth client interface; removed the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/stack-shared/src/interface/client-interface.ts`:
- Around line 1043-1044: The comment above the allowInsecure declaration is
inaccurate: it says "only in test environment" while the code uses
process.env.NODE_ENV !== 'production' so insecure HTTP is permitted in any
non-production environment; update the comment to accurately reflect this
behavior (referencing the allowInsecure constant, tokenEndpoint check, and
NODE_ENV) — e.g., note that insecure HTTP is allowed when NODE_ENV is not
'production' and tokenEndpoint starts with 'http://', rather than "test
environment" only.
Greptile SummaryFixed sign-in bug in development environment by updating the insecure HTTP check for OAuth token endpoints.
The original code only allowed insecure HTTP requests (localhost testing) when Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Application
participant Interface as StackClientInterface
participant Library as OAuth4WebAPI
participant Server as API Server
Note over App,Server: Token Refresh Flow
App->>Interface: Request token refresh
Interface->>Interface: Evaluate environment setting
alt Not in production
Interface->>Library: Grant request (insecure allowed)
else In production
Interface->>Library: Grant request (secure only)
end
Library->>Server: Token request
Server-->>Library: Response
Library-->>Interface: Token data
Interface-->>App: Access token
Note over App,Server: Callback flow uses same logic
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/stack-shared/src/interface/client-interface.ts`:
- Line 168: The current expression for allowInsecure uses
process.env.NODE_ENV.includes(...) which can be undefined and causes TS/runtime
errors; normalize NODE_ENV first (e.g., const env = String(process.env.NODE_ENV
|| '') or process.env.NODE_ENV ?? '') and then replace occurrences so
allowInsecure is computed using env.includes('dev') and env === 'test' with
tokenEndpoint.startsWith('http://'); update any other sites (e.g., the other
occurrence around line 1044) to use the same normalized env variable to avoid
TS18048 and runtime crashes.
♻️ Duplicate comments (1)
packages/stack-shared/src/interface/client-interface.ts (1)
1043-1044: Update the comment to reflect dev/test behavior.The comment says “test environment only,” but the condition also allows dev. Align the comment with the actual logic.
📝 Suggested comment update
- // Allow insecure HTTP requests only in test environment (for localhost testing) + // Allow insecure HTTP requests in dev/test environments (for localhost testing) const allowInsecure = (process.env.NODE_ENV.includes("dev") || process.env.NODE_ENV === 'test') && tokenEndpoint.startsWith('http://');
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Updated internal environment detection mechanism for OAuth flows. Insecure HTTP requests are now allowed when running outside of production environments, rather than only during testing scenarios. No changes to public APIs. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.