GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(mtls): Fix EndpointContext's determineEndpoint logic to respect env var by andyrzhao · Pull Request #3912 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Conversation

@andyrzhao

@andyrzhao andyrzhao commented Sep 23, 2025

Copy link
Copy Markdown
Contributor

Only attempt to create a default MtlsProvider in "determineEndpoint" if client certificate usage is enabled by the env var GOOGLE_API_USE_CLIENT_CERTIFICATE.

Advisory Note: GOOGLE_API_USE_CLIENT_CERTIFICATE will default to true (if not set) in a future release, so if you do not wish to enable mTLS (such as for testing environments) please explicitly set GOOGLE_API_USE_CLIENT_CERTIFICATE to false before executing your test suite.

Fixes #3911 ☕️

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@andyrzhao
fix(mtls): Fix EndpointContext's determineEndpoint logic to respect e…
a74dd57
…nv var
@product-auto-label product-auto-label Bot added the size: s Pull request size is small. label Sep 23, 2025
lqiu96
lqiu96 reviewed Sep 23, 2025
View reviewed changes
Comment thread gax-java/gax/src/main/java/com/google/api/gax/rpc/EndpointContext.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

lqiu96
lqiu96 reviewed Sep 23, 2025
View reviewed changes
Comment thread gax-java/gax/src/main/java/com/google/api/gax/rpc/EndpointContext.java
Comment on lines +303 to +307
} catch (IOException e) {
LOG.log(
Level.WARNING,
"DefaultMtlsProviderFactory encountered unexpected IOException: " + e.getMessage());
}

@lqiu96 lqiu96 Sep 23, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

There may be a reason for this and I've since lost the context for this. Do you remember why this is logged and not thrown back to the user?

This IOException occurs when trying to create the MtlsProvider when a user enables Mtls (via Env Var).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@andyrzhao andyrzhao Sep 23, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yes, this warning is logged when the SDK detects the necessary mTLS config on the device, but the mTLS helper fails unexpectedly (ex. WARNING: DefaultMtlsProviderFactory encountered unexpected IOException: SecureConnect: Cert provider command failed with exit code: 139). In this case, mTLS is still disabled, the app doesn't crash, but a warning is logged because the helper command should not be failing - this reveals an underlying bug with the helper that should be fixed by the owning team. In other words, WARN if the user intends to use mTLS and it fails, and NO WARN if user never intended to use mTLS.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lqiu96 lqiu96 Sep 24, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Hmm, in that case can the logs add some like mTLS is disabled and falling back to TLS?

Would there be any possible security implications where we fall back to TLS and not use mTLS without erroring out? This may be already covered/ approved, but I'm wondering if the user doesn't see this warning and assumes that they're running on mTLS when it turns out it isn't.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@andyrzhao andyrzhao Sep 24, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good question - what happens is that if the user (or the workload) is under CAA-policy enforcement ("require mTLS"), they will receive an "Access Denied" error when trying to access GCP resources. I will include the message you suggested to help with debugging.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lqiu96 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@lqiu96 lqiu96 Sep 24, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

One follow up question for this. What about if the user/ workload is not under CAA-policy enforcement? Or is that going to be enabled for everyone in the future?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@andyrzhao andyrzhao Sep 24, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

If the user/workload is not under CAA-policy enforcement, then the requests will simply succeed even when hitting the non-mTLS endpoints.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lqiu96 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@lqiu96

lqiu96 commented Sep 23, 2025

Copy link
Copy Markdown
Member

/gcbrun

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andyrzhao
andyrzhao requested a review from lqiu96 September 24, 2025 06:24
@andyrzhao
fix(mtls): Address code-review comments.
81890df
@lqiu96

lqiu96 commented Sep 24, 2025

Copy link
Copy Markdown
Member

/gcbrun

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lqiu96

lqiu96 commented Sep 24, 2025

Copy link
Copy Markdown
Member

there looks to be some flaky tests in the CI. Re-running the jobs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lqiu96

lqiu96 commented Sep 24, 2025

Copy link
Copy Markdown
Member

/gcbrun

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lqiu96
lqiu96 approved these changes Sep 24, 2025
View reviewed changes
@lqiu96
lqiu96 merged commit e5948d0 into googleapis:main Sep 24, 2025
@release-please release-please Bot mentioned this pull request Sep 24, 2025
chore(main): release 2.62.3 #3914
Merged
mpeddada1 added a commit that referenced this pull request Oct 2, 2025
@release-please @mpeddada1
chore(main): release 2.62.3 (#3914)
e4e38eb
🤖 I have created a release *beep* *boop*
---


<details><summary>2.62.3</summary>

##
[2.62.3](v2.62.2...v2.62.3)
(2025-10-02)


### Bug Fixes

* **mtls:** Fix EndpointContext's determineEndpoint logic to respect env
var
([#3912](#3912))
([e5948d0](e5948d0))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Mridula <[email protected]>
@release-please release-please Bot mentioned this pull request Dec 11, 2025
chore(protobuf-4.x-rc): release 2.65.0-rc1 #3999
Merged
lqiu96 pushed a commit that referenced this pull request Feb 12, 2026
@andyrzhao @lqiu96
fix(mtls): Fix EndpointContext's determineEndpoint logic to respect e…
681fd56
…nv var (#3912)

Only attempt to create a default MtlsProvider in "determineEndpoint" if
client certificate usage is enabled by the env var
GOOGLE_API_USE_CLIENT_CERTIFICATE.

Advisory Note: GOOGLE_API_USE_CLIENT_CERTIFICATE will default to true
(if not set) in a future release, so if you do not wish to enable mTLS
(such as for testing environments) please explicitly set
GOOGLE_API_USE_CLIENT_CERTIFICATE to false before executing your test
suite.

Fixes #3911 ☕️
lqiu96 pushed a commit that referenced this pull request Feb 12, 2026
@release-please @mpeddada1 @lqiu96
chore(main): release 2.62.3 (#3914)
326fc9f
🤖 I have created a release *beep* *boop*
---


<details><summary>2.62.3</summary>

##
[2.62.3](v2.62.2...v2.62.3)
(2025-10-02)


### Bug Fixes

* **mtls:** Fix EndpointContext's determineEndpoint logic to respect env
var
([#3912](#3912))
([e5948d0](e5948d0))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Mridula <[email protected]>
chingor13 pushed a commit to googleapis/google-cloud-java that referenced this pull request Mar 24, 2026
@release-please @mpeddada1
chore(main): release 2.62.3 (#3914)
01d50d8
🤖 I have created a release *beep* *boop*
---


<details><summary>2.62.3</summary>

##
[2.62.3](googleapis/sdk-platform-java@v2.62.2...v2.62.3)
(2025-10-02)


### Bug Fixes

* **mtls:** Fix EndpointContext's determineEndpoint logic to respect env
var
([#3912](googleapis/sdk-platform-java#3912))
([16591aa](googleapis/sdk-platform-java@16591aa))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Mridula <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@lqiu96 lqiu96 lqiu96 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size: s Pull request size is small.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Availability check for mtls is always executed, even when the application wants to use plain text

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@andyrzhao @lqiu96
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.