Skip to content

fix(auth): avoid creating mTLS SSL context for custom async transports#17825

Merged
attharva-24 merged 1 commit into
googleapis:mainfrom
attharva-24:fix/b-530712364
Jul 22, 2026
Merged

fix(auth): avoid creating mTLS SSL context for custom async transports#17825
attharva-24 merged 1 commit into
googleapis:mainfrom
attharva-24:fix/b-530712364

Conversation

@attharva-24

@attharva-24 attharva-24 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

If a custom async transport is used (rather than the default AiohttpRequest), the library warns that it cannot configure mTLS. In this case, we should also skip creating the client cert SSL context, preventing unexpected errors or warnings during SSL context generation when a custom transport is in use.

Fixes: b/530712364
Fixes #17622

@attharva-24
attharva-24 requested review from a team as code owners July 22, 2026 16:36

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request defers the creation of the SSL context during mTLS configuration until after verifying that the request handler is an instance of AiohttpRequest. This prevents unnecessary SSL context creation when a custom transport is used. Additionally, a new test case has been added to verify behavior with custom transports and invalid certificates, and existing tests have been updated to reflect that the SSL context creation helper is no longer called in these scenarios. There are no review comments, so no further feedback is provided.

@macastelaz macastelaz self-assigned this Jul 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is a small formatting change needed here to "fix" the failing lint CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed ✅

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - small nit on workflow - in the future try to avoid force pushing, especially after reviews have started, as it can makes following the changes a bit more challenging (though in this case, no harm was really done given the scope of the PR).

If a custom async transport is used (rather than the default AiohttpRequest),
the library warns that it cannot configure mTLS. In this case, we should
also skip creating the client cert SSL context, preventing unexpected errors
or warnings during SSL context generation when a custom transport is in use.

Fixes: b/530712364
@attharva-24
attharva-24 merged commit fbe33f9 into googleapis:main Jul 22, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

google-auth: prevent custom transport crash on malformed certs during ssl_context creation

2 participants