Skip to content

Commit 68bdaba

Browse files
authored
feat(auth): add deprecation warning for grpcio < 1.83.0 (PQC support) (#18070)
Emits a deprecation `FutureWarning` when `google.auth.transport.grpc` is imported with `grpcio < 1.83.0`. In October 2026, Google Cloud client libraries (including `google-auth`) will raise minimum requirements to enforce `grpcio >= 1.83.0` for Post-Quantum Cryptography (PQC) support. Towards: b/537446703
1 parent 9f1477c commit 68bdaba

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

packages/google-auth/google/auth/transport/grpc.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from __future__ import absolute_import
1818

1919
import logging
20+
import warnings
2021

2122
from google.auth import exceptions
2223
from google.auth.transport import _mtls_helper
@@ -30,6 +31,26 @@
3031
"gRPC is not installed from please install the grpcio package to use the gRPC transport."
3132
) from caught_exc
3233

34+
35+
_grpc_ver_str = getattr(grpc, "__version__", None)
36+
if isinstance(_grpc_ver_str, str):
37+
_parts = []
38+
for _part in _grpc_ver_str.split("."):
39+
try:
40+
_parts.append(int(_part))
41+
except ValueError:
42+
break
43+
if _parts and tuple(_parts) < (1, 83, 0):
44+
warnings.warn(
45+
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
46+
"Support for non-PQC environments is deprecated. In October 2026, "
47+
"google-auth will raise its minimum requirements "
48+
"to enforce grpcio >= 1.83.0. "
49+
"For more details on Google Cloud's post-quantum security migration, visit: "
50+
"https://cloud.google.com/security/resources/post-quantum-cryptography",
51+
FutureWarning,
52+
)
53+
3354
_LOGGER = logging.getLogger(__name__)
3455

3556

packages/google-auth/tests/transport/test_grpc.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
# limitations under the License.
1414

1515
import datetime
16+
import importlib
1617
import os
1718
import time
1819
from unittest import mock
20+
import warnings
1921

2022
import pytest # type: ignore
2123

@@ -678,3 +680,25 @@ def test_get_client_ssl_credentials_auto_enablement(
678680
mock_ssl_channel_credentials.assert_called_once_with(
679681
certificate_chain=PUBLIC_CERT_BYTES, private_key=PRIVATE_KEY_BYTES
680682
)
683+
684+
685+
def test_grpc_version_warning_for_older_version(monkeypatch):
686+
monkeypatch.setattr(grpc, "__version__", "1.80.0")
687+
with pytest.warns(
688+
FutureWarning, match="does not support Post-Quantum Cryptography"
689+
):
690+
importlib.reload(google.auth.transport.grpc)
691+
692+
693+
def test_grpc_version_warning_not_emitted_for_supported_version(monkeypatch):
694+
monkeypatch.setattr(grpc, "__version__", "1.83.0")
695+
with warnings.catch_warnings():
696+
warnings.simplefilter("error", FutureWarning)
697+
importlib.reload(google.auth.transport.grpc)
698+
699+
700+
def test_grpc_version_warning_not_emitted_when_no_version(monkeypatch):
701+
monkeypatch.delattr(grpc, "__version__", raising=False)
702+
with warnings.catch_warnings():
703+
warnings.simplefilter("error", FutureWarning)
704+
importlib.reload(google.auth.transport.grpc)

0 commit comments

Comments
 (0)