fix: validate orgSlug before OIDC database query to prevent undefined binding error#5318
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
fix: validate orgSlug before OIDC database query to prevent undefined binding error#5318devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
… binding error When the OIDC callback is invoked with an expired or invalid session, the orgSlug retrieved from the session is undefined. This was causing a database error: 'Undefined binding(s) detected when compiling FIRST. Undefined column(s): [slug]' This fix adds validation in both the router and service layer: 1. Router: Check if oidcOrgSlug is defined before calling getOrgAuthStrategy 2. Service: Defensive check for orgSlug parameter Now users will see a clear error message asking them to try logging in again instead of a cryptic database error. Co-Authored-By: maidul@infisical.com <maidul98@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
Greptile OverviewGreptile SummaryThis PR fixes a database error that occurred when OIDC callback was invoked with an expired or invalid session. The fix adds validation in both the router and service layer to check for undefined Key Changes:
Impact:
Confidence Score: 5/5
Important Files Changed
|
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.
Context
Fixes a database error that occurs when the OIDC callback is invoked with an expired or invalid session. When the session data is missing,
oidcOrgSlugisundefined, which was being passed directly to the database query causing:This PR adds validation in both the router and service layer to check for undefined
orgSlugbefore executing the database query, providing a clear error message instead of a cryptic database error.Before: Users see a confusing database error when their OIDC session expires
After: Users see "OIDC session expired or invalid. Please try logging in again."
Steps to verify the change
/api/v1/sso/oidc/login?orgSlug=...)Type
Checklist
Link to Devin run: https://app.devin.ai/sessions/049a65b5187142259841898a8cd0375d
Requested by: @maidul98