René's URL Explorer Experiment


Title: Fix(auth): incorrect mTLS endpoint detection causes false positive cert rotations and breaks PSC endpoints · Issue #18147 · googleapis/google-cloud-python · GitHub

Open Graph Title: Fix(auth): incorrect mTLS endpoint detection causes false positive cert rotations and breaks PSC endpoints · Issue #18147 · googleapis/google-cloud-python

X Title: Fix(auth): incorrect mTLS endpoint detection causes false positive cert rotations and breaks PSC endpoints · Issue #18147 · googleapis/google-cloud-python

Description: Description In PR #17928, a check was added to AuthorizedSession.request (and pre-existed in AuthorizedHttp.urlopen) to only trigger mTLS client certificate rotation on mTLS endpoints upon receiving a 401 Unauthorized response: MTLS_URL_...

Open Graph Description: Description In PR #17928, a check was added to AuthorizedSession.request (and pre-existed in AuthorizedHttp.urlopen) to only trigger mTLS client certificate rotation on mTLS endpoints upon receivin...

X Description: Description In PR #17928, a check was added to AuthorizedSession.request (and pre-existed in AuthorizedHttp.urlopen) to only trigger mTLS client certificate rotation on mTLS endpoints upon receivin...

Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/18147

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fix(auth): incorrect mTLS endpoint detection causes false positive cert rotations and breaks PSC endpoints","articleBody":"### Description\nIn PR #17928, a check was added to `AuthorizedSession.request` (and pre-existed in `AuthorizedHttp.urlopen`) to only trigger mTLS client certificate rotation on mTLS endpoints upon receiving a `401 Unauthorized` response:\n\n```python\nMTLS_URL_PREFIXES = [\"mtls.googleapis.com\", \"mtls.sandbox.googleapis.com\"]\nuse_mtls = self.is_mtls and any(prefix in url for prefix in MTLS_URL_PREFIXES)\n```\n\n**However, this implementation has two critical defects:**\n\n1. False Positives via Substring Matching (prefix in url)\nUsing Python's in operator performs a substring search across the entire URL string (including path segments and query parameters). Any standard, non-mTLS URL that happens to contain mtls.googleapis.com anywhere in its path or query string (e.g. https://storage.googleapis.com/my-bucket/logs/mtls.googleapis.com.csv or https://logging.googleapis.com/v2/entries?filter=mtls.googleapis.com) evaluates to True. When an OAuth access token expires on these non-mTLS URLs, the transport falsely assumes the client certificate expired, triggering unnecessary certificate parsing, disk I/O, and SSL adapter reconfiguration.\n\n2. False Negatives on Private Service Connect (PSC) Endpoints\nEnterprise customers connecting via Private Service Connect (PSC) use endpoints under *.p.googleapis.com (e.g. https://storage.p.googleapis.com or https://pubsub.p.googleapis.com). These endpoints use mTLS, but because their hostname does not contain the substring mtls.googleapis.com, use_mtls evaluates to False. As a result, client certificate rotation upon certificate expiration is permanently broken for PSC users.\n\n**Expected Behavior**\n\n- Only genuine mTLS endpoints (e.g. *.mtls.googleapis.com, *.mtls.sandbox.googleapis.com, and *.p.googleapis.com) should trigger certificate rotation checks.\n- URL paths and query parameters should not influence mTLS endpoint detection.\n\n**Actual Behavior**\n\n- Non-mTLS URLs containing mtls.googleapis.com in paths/queries trigger certificate rotation on 401.\n- PSC mTLS endpoints (*.p.googleapis.com) fail to trigger certificate rotation on 401.\n\n**Proposed Solution**\n\n1. Introduce a centralized helper is_mtls_endpoint(url) in google.auth.transport._mtls_helper that isolates and parses the hostname using urllib.parse.urlsplit(url).hostname.\n2. Validate the hostname against:\n  - Exact hosts: mtls.googleapis.com, mtls.sandbox.googleapis.com\n  - Standard mTLS suffixes: .mtls.googleapis.com, .mtls.sandbox.googleapis.com\n  - Private Service Connect (PSC) suffixes: .p.googleapis.com\n3. Update both requests.py (AuthorizedSession) and urllib3.py (AuthorizedHttp) to use this shared helper.","author":{"url":"https://github.com/attharva-24","@type":"Person","name":"attharva-24"},"datePublished":"2026-08-18T21:59:24Z","url":"https://github.com/googleapis/google-cloud-python/issues/18147"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:de703196-6980-f41d-aa19-e681c3985bf2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEE20:10CB0:42569C:56F4BD:6AFE62A1
html-safe-nonce93e172ae14e571fd854e106b7e1edc85d2d7978853c40ecebafa6d342acfdc6a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTIwOjEwQ0IwOjQyNTY5Qzo1NkY0QkQ6NkFGRTYyQTEiLCJ2aXNpdG9yX2lkIjoiMTU0OTY3NjE3OTg4NjA3MjQ4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc0f8953b6aa247aee439d962bb4c47394e534c0e64cb2d112a080e93636a66c5
hovercard-subject-tagissue:5186691574
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/18147/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5bf2a2f0aa4f95fb0779bafde067e84e2c09e4cbd1ab3c1def7e0484a2f9e175/googleapis/google-cloud-python/issues/18147
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5bf2a2f0aa4f95fb0779bafde067e84e2c09e4cbd1ab3c1def7e0484a2f9e175/googleapis/google-cloud-python/issues/18147
og:image:altDescription In PR #17928, a check was added to AuthorizedSession.request (and pre-existed in AuthorizedHttp.urlopen) to only trigger mTLS client certificate rotation on mTLS endpoints upon receivin...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameattharva-24
hostnamegithub.com
expected-hostnamegithub.com
Noneb3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86
turbo-cache-controlno-preview
go-importgithub.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id16316451
octolytics-dimension-repository_nwogoogleapis/google-cloud-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id16316451
octolytics-dimension-repository_network_root_nwogoogleapis/google-cloud-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4a10310af51a1bfffbedc4fd81cb582acf0cb0ff
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/googleapis/google-cloud-python/issues/18147#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fgoogle-cloud-python%2Fissues%2F18147
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fgoogle-cloud-python%2Fissues%2F18147
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=googleapis%2Fgoogle-cloud-python
Reloadhttps://github.com/googleapis/google-cloud-python/issues/18147
Reloadhttps://github.com/googleapis/google-cloud-python/issues/18147
Reloadhttps://github.com/googleapis/google-cloud-python/issues/18147
googleapishttps://github.com/googleapis
google-cloud-pythonhttps://github.com/googleapis/google-cloud-python
Codehttps://github.com/googleapis/google-cloud-python
Issues450 (450)https://github.com/googleapis/google-cloud-python/issues
Pull requests200 (200)https://github.com/googleapis/google-cloud-python/pulls
Discussionshttps://github.com/googleapis/google-cloud-python/discussions
Actionshttps://github.com/googleapis/google-cloud-python/actions
Projectshttps://github.com/googleapis/google-cloud-python/projects
Security and qualityhttps://github.com/googleapis/google-cloud-python/security
Insightshttps://github.com/googleapis/google-cloud-python/insights
https://github.com/googleapis/google-cloud-python
New issuehttps://github.com/login?return_to=https://github.com/googleapis/google-cloud-python/issues/18147
New issuehttps://github.com/login?return_to=https://github.com/googleapis/google-cloud-python/issues/18147
#18201https://github.com/googleapis/google-cloud-python/pull/18201
#18153https://github.com/googleapis/google-cloud-python/pull/18153
Fix(auth): incorrect mTLS endpoint detection causes false positive cert rotations and breaks PSC endpointshttps://github.com/googleapis/google-cloud-python/issues/18147#top
#18201https://github.com/googleapis/google-cloud-python/pull/18201
#18153https://github.com/googleapis/google-cloud-python/pull/18153
https://github.com/attharva-24
https://github.com/attharva-24
attharva-24https://github.com/attharva-24
on Aug 18, 2026https://github.com/googleapis/google-cloud-python/issues/18147#issue-5186691574
#17928https://github.com/googleapis/google-cloud-python/pull/17928
https://storage.googleapis.com/my-bucket/logs/mtls.googleapis.com.csvhttps://storage.googleapis.com/my-bucket/logs/mtls.googleapis.com.csv
https://logging.googleapis.com/v2/entries?filter=mtls.googleapis.comhttps://logging.googleapis.com/v2/entries?filter=mtls.googleapis.com
https://storage.p.googleapis.comhttps://storage.p.googleapis.com
https://pubsub.p.googleapis.comhttps://pubsub.p.googleapis.com
macastelazhttps://github.com/macastelaz
attharva-24https://github.com/attharva-24
on Aug 18, 2026https://github.com/googleapis/google-cloud-python/issues/18147#event-29647941499
attharva-24https://github.com/attharva-24
on Aug 19, 2026https://github.com/googleapis/google-cloud-python/issues/18147#event-29665093235
fix(auth): parse hostname for mTLS and PSC endpoint certificate rotat…https://github.com/attharva-24/google-cloud-python/commit/e33b6c9fa3a75016d9a5ed9ebbcc0f88e4dbcd5f
e33b6c9https://github.com/attharva-24/google-cloud-python/commit/e33b6c9fa3a75016d9a5ed9ebbcc0f88e4dbcd5f
fix(auth): parse hostname for mTLS and PSC endpoint certificate rotat…https://github.com/attharva-24/google-cloud-python/commit/f217bfc06430efd857019f978ff96aea7454e84a
f217bfchttps://github.com/attharva-24/google-cloud-python/commit/f217bfc06430efd857019f978ff96aea7454e84a
fix(auth): parse hostname for mTLS and PSC endpoint certificate rotat…https://github.com/attharva-24/google-cloud-python/commit/7fecb67a6233694ee95d64162b2f1e6394b6780d
7fecb67https://github.com/attharva-24/google-cloud-python/commit/7fecb67a6233694ee95d64162b2f1e6394b6780d
fix(auth): parse hostname for mTLS and PSC endpoint certificate rotat…https://github.com/attharva-24/google-cloud-python/commit/b62913568ae5d9e6c03c53bd1d0a92a37371612f
b629135https://github.com/attharva-24/google-cloud-python/commit/b62913568ae5d9e6c03c53bd1d0a92a37371612f
fix(auth): parse hostname for mTLS and PSC endpoint certificate rotat…https://github.com/attharva-24/google-cloud-python/commit/f11e33d97563d5996910174fdc76d11f7fd17df7
f11e33dhttps://github.com/attharva-24/google-cloud-python/commit/f11e33d97563d5996910174fdc76d11f7fd17df7
fix(auth): parse hostname for mTLS and PSC endpoint certificate rotat… (https://github.com/googleapis/google-cloud-python/commit/b6423734a2470acd01a7081a4133e4373206f325
b642373https://github.com/googleapis/google-cloud-python/commit/b6423734a2470acd01a7081a4133e4373206f325
attharva-24https://github.com/attharva-24
completedhttps://github.com/googleapis/google-cloud-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#18153https://github.com/googleapis/google-cloud-python/pull/18153
on Aug 21, 2026https://github.com/googleapis/google-cloud-python/issues/18147#event-29817627361
attharva-24https://github.com/attharva-24
on Aug 21, 2026https://github.com/googleapis/google-cloud-python/issues/18147#event-29833258415
fix(auth): parse hostname for mTLS and PSC endpoint certificate rotat…https://github.com/attharva-24/google-cloud-python/commit/9019e4e9a994b7f4238cdd5e64f376f4fbae6ad1
9019e4ehttps://github.com/attharva-24/google-cloud-python/commit/9019e4e9a994b7f4238cdd5e64f376f4fbae6ad1
macastelazhttps://github.com/macastelaz
on Aug 25, 2026https://github.com/googleapis/google-cloud-python/issues/18147#event-29999370175
partheahttps://github.com/parthea
on Sep 3, 2026https://github.com/googleapis/google-cloud-python/issues/18147#event-30501573078
fix(auth): parse hostname for mTLS and PSC endpoint certificate rotat…https://github.com/googleapis/google-cloud-python/commit/b18bb4cb749d2dd10d0e2f7d8505460d305e54fc
b18bb4chttps://github.com/googleapis/google-cloud-python/commit/b18bb4cb749d2dd10d0e2f7d8505460d305e54fc
partheahttps://github.com/parthea
completedhttps://github.com/googleapis/google-cloud-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#18201https://github.com/googleapis/google-cloud-python/pull/18201
on Sep 3, 2026https://github.com/googleapis/google-cloud-python/issues/18147#event-30501573135
partheahttps://github.com/parthea
on Sep 4, 2026https://github.com/googleapis/google-cloud-python/issues/18147#event-30523065190
chore: release main (#18276)https://github.com/googleapis/google-cloud-python/commit/036f734e43e17f7fdab238f7cc653f5f98e45131
#18276https://github.com/googleapis/google-cloud-python/pull/18276
036f734https://github.com/googleapis/google-cloud-python/commit/036f734e43e17f7fdab238f7cc653f5f98e45131
Sign up for freehttps://github.com/signup?return_to=https://github.com/googleapis/google-cloud-python/issues/18147
Sign in to commenthttps://github.com/login?return_to=https://github.com/googleapis/google-cloud-python/issues/18147
attharva-24https://github.com/attharva-24
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.