Skip to content

test: add post-quantum cryptography conformance tests for showcase - #1351

Draft
torreypayne wants to merge 1 commit into
pqc-tls-validationfrom
pqc-validation-tests
Draft

torreypayne wants to merge 1 commit into
pqc-tls-validationfrom
pqc-validation-tests

Conversation

@torreypayne

@torreypayne torreypayne commented Sep 15, 2026

Copy link
Copy Markdown
Member

Adds shared/test/showcase/pqc_test.rb, proving Ruby clients negotiate X25519MLKEM768 against Showcase over both transports.

Ruby never performs the key exchange itself — gRPC delegates to BoringSSL vendored in the grpc gem, REST to system OpenSSL. The suite therefore asserts on what the server observed, via the x-showcase-tls-group and x-showcase-tls-client-supported-groups metadata Showcase reflects onto every response. Python, Node, Java, C#, and C++ assert the same way.

Two scenarios per transport: default negotiation, and fallback against a classical-only server.

Reviewer notes

  • The gRPC tests assert grpc >= 1.83 up front. Nothing here pins grpc — it resolves through gapic-common, so PQC holds only because bundler picks the newest match. Without the check a downgrade reads as a protocol bug. ruby-core-libraries#73 raises that floor.
  • The fallback tests also assert the client still offered X25519MLKEM768. Otherwise the test would pass against a client that had lost PQC entirely. For REST that half is gated on SHOWCASE_REQUIRE_REST_PQC, since below OpenSSL 3.5 there is no PQC group to withhold.
  • REST never skips. No runner available to us has OpenSSL >= 3.5, so a version-guarded skip would mean REST is never exercised at all. It runs against a {X25519MLKEM768, X25519} allowlist; chore(ci): hard-assert REST post-quantum key exchange on an OpenSSL 3.5 image #1352 tightens that on a 3.5 image.
  • normalize_headers fails loudly when TLS metadata is absent, so plaintext cannot silently no-op the suite.

Green, zero skips across OpenSSL 3.0.18 / 3.5.5 / 3.6.3 and Ruby 3.2 / 4.0.


Sits on #1330 (fork-hosted, so excluded from the stack).
Design: go/client-libraries:ruby-pqc · Parent: go/cloudsdk-pqc-ruby

Adds a dedicated suite that proves the generated Ruby clients negotiate
X25519MLKEM768 with the Showcase server over both transports.

Assertions read the TLS metadata that Showcase reflects onto every response
(x-showcase-tls-group and x-showcase-tls-client-supported-groups) rather than
inspecting CRuby's internal OpenSSL structures, whose layout is not stable
across Ruby releases or platforms.

Covered scenarios:
- gRPC and REST negotiate the hybrid post-quantum group and advertise it in
  their ClientHello.
- Both transports degrade cleanly to classical X25519 when the server offers
  only classical groups. These also assert the client still advertised
  X25519MLKEM768: without that, the test would pass just as happily against a
  client that had lost post-quantum support altogether.

The classical-only case needs a second Showcase process, since --tls-groups
applies to a whole server. That auxiliary process mints a certificate authority
of its own, so the test points SSL_CERT_FILE at the new CA for the duration of
the block and builds explicit gRPC credentials from it.

REST cannot be held to post-quantum key exchange unconditionally. It delegates
to the host's OpenSSL, and ML-KEM only exists from OpenSSL 3.5 onward, while
GitHub Actions ubuntu-latest ships 3.0.13. Skipping on older hosts would leave
the REST transport unexercised in CI entirely, which is a permanently green
check that verifies nothing. Instead the negotiated group must be present
(proving the connection was genuinely TLS), must be either X25519MLKEM768 or
classical X25519, and must be a group the client actually offered. Setting
SHOWCASE_REQUIRE_REST_PQC=1 promotes this into a strict post-quantum assertion.

Group membership is tested against the split supported-groups list rather than
the raw header value, because "X25519" is a substring of "X25519MLKEM768" and a
string containment check could therefore never fail.

This mirrors the merged conformance test in gax-php. Ruby and PHP are the only
Cloud SDK languages whose REST transport binds to the system OpenSSL instead of
a vendored TLS stack, so they are the only two that cannot hard-assert
post-quantum key exchange on a stock runner.
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.

1 participant