fix: mcp auth TLS gate falls back to entry.url when caller omits url - #3797
Open
dylanyunlon wants to merge 1 commit into
Open
fix: mcp auth TLS gate falls back to entry.url when caller omits url#3797dylanyunlon wants to merge 1 commit into
dylanyunlon wants to merge 1 commit into
Conversation
dylanyunlon
requested review from
MohammadHaroonAbuomar and
liamcrumm
as code owners
August 21, 2026 03:36
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Welcome to the Agent Governance Toolkit! Thanks for your first pull request. |
|
🟡 Contributor Check: MEDIUM
Automated check by AGT Contributor Check. |
…icrosoft#3785) * fix: consult entry.url in TLS gate when caller-supplied url is empty The require_tls gate in McpAuthPolicy.check() previously only evaluated the caller-supplied url argument. When a caller omitted url (or passed ""), the TLS check was silently skipped even when the server entry had require_tls=True and a configured non-TLS entry.url — a denial-of- service vector in multi-tenant setups where the caller is untrusted. The fix resolves an effective_url via: caller url > entry.url > empty. When both sources are empty the gate permits the connection, preserving spec S10.12 compatibility (add_server with default url="" must remain allowed). Signed-off-by: dylanyunlon <dogechat@163.com> * test: add 12 tests for TLS gate entry.url fallback Cover: http/https/wss/ws/ftp entry.url fallback, caller overrides, both-empty S10.12 compat, require_tls=False bypass, no-scheme entry.url, explicit empty string, and YAML end-to-end. Signed-off-by: dylanyunlon <dogechat@163.com> * docs: add MCP auth TLS gate documentation Document URL resolution order, configuration examples, YAML config, allowed TLS schemes, and security considerations for the entry.url fallback behavior. Signed-off-by: dylanyunlon <dogechat@163.com> --------- Signed-off-by: dylanyunlon <dogechat@163.com>
dylanyunlon
force-pushed
the
fix/mcp-auth-tls-entry-url-fallback
branch
from
August 21, 2026 03:37
77da419 to
d4297ad
Compare
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
Author
|
@microsoft-github-policy-service agree |
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
Fixes #3785 — the
require_tlsgate inMcpAuthPolicy.check()never consulted the configuredentry.urlwhen the caller-suppliedurlwas empty (or omitted). A caller that simply omitsurlcould bypass the TLS requirement even when the server entry hadrequire_tls: trueand a configured non-TLSentry.url.Changes
Core fix (
mcp_auth_enforcement.py)The TLS gate now resolves an effective URL via
url or entry.urlbefore evaluating the scheme. When both sources are empty, the gate permits the connection — preserving spec S10.12 compatibility (add_server()with defaulturl=""must remain allowed).Before:
After:
Tests (
test_mcp_auth_enforcement.py)12 new tests in
TestTlsGateEntryUrlFallbackcovering:http/https/wss/ws/ftpentry.url fallback when caller omits urlrequire_tls=FalsebypassAll 29 tests pass (17 existing + 12 new).
Documentation (
docs/mcp-auth-tls.md)New doc covering URL resolution order, configuration examples (Python + YAML), allowed TLS schemes, and security considerations.
README
Added doc link under the Reference section.
Checklist
Signed-off-by: dylanyunlon dogechat@163.com