Constrain Graph v4 authentication to the configured origin - #4012
Merged
Iarek Kovtunenko (iarekk) merged 3 commits intoSep 14, 2026
Merged
Iarek Kovtunenko (iarekk) merged 3 commits into
Iarek Kovtunenko (iarekk) merged 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Constrains Graph v4 authentication tokens to the configured HTTPS origin, including custom Graph proxies.
Changes:
- Validates request origins before and after customization.
- Binds factory-created clients to their HTTPS base URL.
- Adds focused origin-validation and factory tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Microsoft.Identity.Web.MicrosoftGraph/TokenAcquisitionAuthenticationProvider.cs |
Implements origin binding and validation. |
src/Microsoft.Identity.Web.MicrosoftGraph/MicrosoftGraphExtensions.cs |
Binds factory clients to their origin. |
src/Microsoft.Identity.Web.MicrosoftGraph/GraphServiceCollectionExtensions.cs |
Binds configured Graph clients securely. |
src/Microsoft.Identity.Web.MicrosoftGraph/Properties/InternalsVisibleTo.cs |
Enables internal provider testing. |
tests/Microsoft.Identity.Web.Test/TokenAcquisitionAuthenticationProviderTests.cs |
Covers URI validation and authorization cleanup. |
tests/Microsoft.Identity.Web.Test/WebAppExtensionsTests.cs |
Covers custom factory base URLs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Nilesh Choudhary (4gust)
approved these changes
Aug 31, 2026
Bogdan Gavril (bgavrilMS)
approved these changes
Sep 14, 2026
Bogdan Gavril (bgavrilMS)
force-pushed
the
iinglese/graph-request-destination-validation-minimal
branch
from
September 14, 2026 11:05
8f8e911 to
9abebe2
Compare
Iarek Kovtunenko (iarekk)
force-pushed
the
iinglese/graph-request-destination-validation-minimal
branch
from
September 14, 2026 14:55
9abebe2 to
421e6af
Compare
Iarek Kovtunenko (iarekk)
enabled auto-merge (squash)
September 14, 2026 14:55
Iarek Kovtunenko (iarekk)
force-pushed
the
iinglese/graph-request-destination-validation-minimal
branch
from
September 14, 2026 15:13
421e6af to
d3d2098
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Iarek Kovtunenko (iarekk)
force-pushed
the
iinglese/graph-request-destination-validation-minimal
branch
from
September 14, 2026 15:18
d3d2098 to
6b221fc
Compare
Iarek Kovtunenko (iarekk)
deleted the
iinglese/graph-request-destination-validation-minimal
branch
September 14, 2026 15:35
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.
Summary
Release notes
Graph v4 authentication now attaches credentials only to absolute HTTPS request destinations matching the configured client origin. Requests for other destinations continue without an authorization header. Blank base URL configuration continues to use the Graph SDK default, while custom factories must return a client with an absolute HTTPS base URL.
Testing