Skip to content

chore(generator): add post-quantum cryptography (PQC) integration tests - #17586

Merged
ohmayr merged 18 commits into
mainfrom
feat-pqc-verification
Jul 17, 2026
Merged

chore(generator): add post-quantum cryptography (PQC) integration tests#17586
ohmayr merged 18 commits into
mainfrom
feat-pqc-verification

Conversation

@ohmayr

@ohmayr ohmayr commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Adds integration tests against showcase to verify that our libraries support PQC TLS key exchange.

To verify, you can run nox -s showcase_pqc.

@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 adds support for mTLS in REST transport fixtures within conftest.py and introduces a new integration test in test_pqc.py to verify Post-Quantum Cryptography (PQC) negotiation with the Showcase server. The review feedback highlights several critical improvements: resolving a compatibility issue with urllib3 v2.0+ by overriding cert_verify instead of using assert_hostname in PoolManager, adding defensive None checks for gRPC metadata and interceptor attributes to prevent runtime errors, and avoiding shadowing the built-in dir function.

Comment thread packages/gapic-generator/tests/system/conftest.py Outdated
Comment thread packages/gapic-generator/tests/system/conftest.py Outdated
Comment thread packages/gapic-generator/tests/system/conftest.py
Comment thread packages/gapic-generator/tests/system/conftest.py Outdated
Comment thread packages/gapic-generator/tests/system/conftest.py Outdated
Comment thread packages/gapic-generator/tests/system/test_pqc.py Outdated
@ohmayr
ohmayr force-pushed the feat-pqc-verification branch from e6c889a to 2d0fe09 Compare July 7, 2026 06:11
@ohmayr ohmayr changed the title feat: add post-quantum cryptography (PQC) integration tests and fixtures chore(generator): add post-quantum cryptography (PQC) integration tests Jul 16, 2026
@ohmayr
ohmayr marked this pull request as ready for review July 16, 2026 22:10
@ohmayr
ohmayr requested a review from a team as a code owner July 16, 2026 22:10
Comment thread packages/gapic-generator/tests/system/conftest.py Outdated
Comment thread packages/gapic-generator/tests/system/conftest.py
Comment thread packages/gapic-generator/noxfile.py
# Enforce PQC compliance (X25519MLKEM768)
assert (
"MLKEM" in negotiated_group
), f"Failed: {transport_name} Connection did not negotiate X25519MLKEM768! Negotiated: {negotiated_group}"

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.

Do we need to check for X25519MLKEM768 exectly? or *MLKEM*? The assertion and comments seem to suggest different things

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.

We check "MLKEM" in negotiated_group instead of exact string matching (== "X25519MLKEM768") to ensure compatibility across different TLS implementations (BoringSSL on gRPC vs OpenSSL on REST), which format group strings slightly differently (e.g. X25519MLKEM768 vs X25519MLKEM768Draft00).

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.

Gemini says there is also secp256r1MLKEM768. It seems like that's another post-quantum algorithm, but I'm not sure if that's one we want to support or not.

Maybe we should either change the comments to be more general, or the assertion to be more specific?

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.

Honestly, these tests run against Showcase server so it doesn't really matter much.

However, current goal is that we support a Hybrid group which we'll default too. In future, we'll default to a PURE PQC group. So in reality, the backend will only return what they're defaulting too. Keeping it generic is more robust for us.

Comment thread packages/gapic-generator/tests/system/conftest.py Outdated

@daniel-sanche daniel-sanche 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.

LGTM

@ohmayr
ohmayr merged commit 81482ba into main Jul 17, 2026
99 checks passed
@ohmayr
ohmayr deleted the feat-pqc-verification branch July 17, 2026 20:54
hebaalazzeh pushed a commit that referenced this pull request Jul 20, 2026
…ts (#17586)

Adds integration tests against showcase to verify that our libraries
support PQC TLS key exchange.

To verify, you can run `nox -s showcase_pqc`.
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.

2 participants