Session Context Bug fix#3724
Merged
RubenCerna2079 merged 11 commits intoJul 21, 2026
Merged
Conversation
RubenCerna2079
marked this pull request as ready for review
July 15, 2026 18:01
RubenCerna2079
requested review from
Alekhya-Polavarapu,
Aniruddh25,
JerryNixon,
aaronburtle,
anushakolan,
rusamant,
sourabh1007,
souvikghosh04,
stuartpa and
vadeveka
as code owners
July 15, 2026 18:01
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix a SQL Server session-context vulnerability/bug by ensuring user-claim keys used with sp_set_session_context are parameterized (instead of being embedded as a string literal), and it adds a unit test intended to guard against regressions.
Changes:
- Parameterize the
@keyargument passed tosp_set_session_contextinMsSqlQueryExecutor.GetSessionParamsQuery. - Add a new EasyAuth unit test intended to ensure “invalid query” content in the EasyAuth header does not cause unintended database side-effects.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Core/Resolvers/MsSqlQueryExecutor.cs |
Parameterizes session-context keys to avoid claim-type string injection into sp_set_session_context. |
src/Service.Tests/Authentication/EasyAuthAuthenticationUnitTests.cs |
Adds a test intended to validate that malicious EasyAuth header content does not lead to unintended behavior/side-effects. |
Aniruddh25
reviewed
Jul 15, 2026
Aniruddh25
requested changes
Jul 15, 2026
…ncerna/fix-session-context-insertion-bug' into dev/rubencerna/fix-session-context-insertion-bug
Aniruddh25
reviewed
Jul 16, 2026
Aniruddh25
requested changes
Jul 16, 2026
souvikghosh04
approved these changes
Jul 17, 2026
souvikghosh04
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Please address the comments.
Aniruddh25
approved these changes
Jul 21, 2026
Aniruddh25
left a comment
Collaborator
There was a problem hiding this comment.
Approving, but please move test to the right file.
RubenCerna2079
enabled auto-merge (squash)
July 21, 2026 21:02
Aniruddh25
approved these changes
Jul 21, 2026
RubenCerna2079
deleted the
dev/rubencerna/fix-session-context-insertion-bug
branch
July 21, 2026 21:53
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.
Why make this change?
Solves bug related to how we handle specific queries with session-context.
What is this change?
X-MS-CLIENT-PRINCIPALheader as parameters before using them inside of a query.How was this tested?
Added test that ensures that invalid queries are not run through headers with session context.
Sample Request(s)
N/A