GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — fix(auth): verify public/private key match with retries in mTLS keystore loading by macastelaz · Pull Request #14829 · googleapis/google-cloud-java Conversation
|
| * Verifies that {@code privateKey} corresponds to the public key in {@code cert} by performing a | ||
| * test signature and verification. | ||
| */ | ||
| private static void verifyKeyPair(X509Certificate cert, PrivateKey privateKey) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This cert-key check already existed in the Agent Identity flow, and this PR duplicates some of that logic. The two copies have already diverged (for example on "ECDSA" handling and how errors are treated; not sure if that was intentional).
Can we share the core check in a single internal helper (e.g. in MtlsUtils)?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good call — extracted the shared check into @internalapi MtlsUtils.verifyKeyPair(X509Certificate, PrivateKey) in 17102f6 (including the "ECDSA" → "EC" KeyFactory normalization for SunEC). Both MtlsKeyStoreUtils.createMtlsKeyStore and AgentIdentityCertificateValidationUtils.verifyKeyPair now delegate to MtlsUtils.verifyKeyPair, while AgentIdentityCertificateValidationUtils retains its strict RSA/EC/ECDSA algorithm allowlist (UnsupportedKeyAlgorithmException) and boolean/logging contract.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| timeService.sleep(CERT_KEY_MATCH_RETRY_INTERVAL_MS); | ||
| } catch (InterruptedException interrupted) { | ||
| Thread.currentThread().interrupt(); | ||
| throw new IOException( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nit: The description says an interrupt surfaces as InterruptedIOException, which is what MtlsUtils throws, but this throws a plain IOException. Callers can't tell an interrupt apart from a read failure without digging into the cause.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed! X509Provider.getKeyStore() now throws InterruptedIOException (with initCause(interrupted)) to match MtlsUtils and the PR description, and X509ProviderTest now asserts InterruptedIOException.class.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…tion, and add missing tests
|
Thanks for the review @nbayati!
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks Matt, LGTM :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
🤖 I have created a release *beep* *boop* --- <details><summary>1.97.0</summary> ## [1.97.0](v1.96.0...v1.97.0) (2026-11-12) ### ⚠ BREAKING CHANGES * **shopping-merchant:** remove discontinued Merchant API v1beta ([#14942](#14942)) ### Features * **bigquery-jdbc:** adds BigQuery graph integration to DatabaseMetadata methods ([#14930](#14930)) ([950b81b](950b81b)) * **gax:** implement resumable upload session resumption ([#14677](#14677)) ([24728d6](24728d6)) * **grpc-gcp:** add built-in channel_count metric for client library pools ([#14947](#14947)) ([712f043](712f043)) * **grpc-gcp:** add built-in channel_load metric for client library pools ([#14985](#14985)) ([9f87888](9f87888)) * **shopping-merchant:** remove discontinued Merchant API v1beta ([#14942](#14942)) ([2947dfd](2947dfd)) * **storage:** add StorageErrorTypeMapper for standard metrics ([#14694](#14694)) ([a9ac393](a9ac393)) * **storage:** add StorageMetricsContext for operation metrics state ([#14728](#14728)) ([edea395](edea395)) * **storage:** wire logical operation metrics in Retrying and StorageOptions ([#14695](#14695)) ([589c66c](589c66c)) * update API sources and regenerate ([#14958](#14958)) ([75944f3](75944f3)) ### Bug Fixes * **auth:** verify public/private key match with retries in mTLS keystore loading ([#14829](#14829)) ([096dbd6](096dbd6)) * **bigquery:** set QueryResultsFormat.ARROW in QueryArrow sample ([#14960](#14960)) ([c98e7c3](c98e7c3)) * **bigtable:** avoid triggering per-RPC credential session fallback on default call context ([#14961](#14961)) ([eb06d2c](eb06d2c)) * **bigtable:** copy Metadata per GetClientConfiguration call ([#14950](#14950)) ([278fe2f](278fe2f)) * **bigtable:** disable SwitchingChannelPool when ChannelPoolConfiguration is empty ([#14911](#14911)) ([fa24702](fa24702)) * **bigtable:** handle empty SessionPoolConfiguration in SessionPoolImpl and PoolSizer ([#14912](#14912)) ([cc7b235](cc7b235)) * **bigtable:** replace SessionPoolImpl Watchdog with per-session closeTimeout ([#14977](#14977)) ([a15acfb](a15acfb)) * **spanner-jdbc:** report database default isolation level ([#14929](#14929)) ([7e7595a](7e7595a)) * **spanner:** fix PG SHOW isolation level statements ([#14904](#14904)) ([bc917ed](bc917ed)) ### Dependencies * bump grpc to 1.85.1, opentelemetry to 1.67.0, and guava to 33.7.2-jre ([#14957](#14957)) ([1a27a00](1a27a00)) * bump guava to 33.7.1-jre and jspecify to 1.0.1 ([#14937](#14937)) ([1441527](1441527)) ### Documentation * **spanner:** update CHANGELOG.md for java spanner releases ([#14935](#14935)) ([956681e](956681e)) * **storage:** add Rapid Cache samples ([#14886](#14886)) ([e714f62](e714f62)) </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>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.