Conversation
POST /sql-driver/{conversationId}/execute was gated only by
[Authorize] (any logged-in user, no role check) and performed no
check that the caller owns conversationId. The underlying
ConversationService.SetConversationId call has no ownership check
either, and silently creates a new conversation using the caller's
own user id if the given id doesn't already exist, so any
authenticated user could execute an arbitrary SQL statement against
any configured data source by supplying a conversationId of their
own choosing. The sibling endpoint /sql-driver/{conversationId}/result
had the identical gap.
Add the same admin-or-owner check ConversationController.GetConversation
already applies when reading a conversation's own dialog (IUserService.
IsAdminUser plus a ConversationFilter.UserId filter), to both
ExecuteSqlQuery and AddQueryExecutionResult.
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
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.
Fixes #1441
Summary
POST /sql-driver/{conversationId}/execute(and the sibling/sql-driver/{conversationId}/result) were gated only by[Authorize]with no check that the caller ownsconversationId. SinceConversationService.SetConversationIdhas no ownership check either and silently creates a new conversation for an unknown id, any authenticated user could execute arbitrary SQL against any configured data source by supplying a conversation id of their own choosing.Fix
Add the same admin-or-owner check
ConversationController.GetConversationalready applies when reading a conversation's own dialog (IUserService.IsAdminUserplus aConversationFilter.UserIdfilter), to bothExecuteSqlQueryandAddQueryExecutionResult.Testing
Built the actual
BotSharp.Plugin.SqlDriverproject against the real solution (dotnet build), confirming 0 errors. I was not able to complete a full running-server end-to-end HTTP test in the time available (the full solution build, across all plugins, is fairly heavy); the fix reuses the exact same service calls (IUserService.IsAdminUser,IConversationService.GetConversations,ConversationFilter) already exercised by the workingConversationController.GetConversationaction in the same repository, so I'm confident in its correctness, but flagging this so a maintainer can do a final runtime check before merging.