Skip to content

chore: [WIP] PQC for TLS proof of concept#12970

Draft
diegomarquezp wants to merge 1 commit intomainfrom
chore/pqc-poc
Draft

chore: [WIP] PQC for TLS proof of concept#12970
diegomarquezp wants to merge 1 commit intomainfrom
chore/pqc-poc

Conversation

@diegomarquezp
Copy link
Copy Markdown
Contributor

No description provided.

@diegomarquezp diegomarquezp changed the title chore: PQC for TLS proof of concept chore: [WIP] PQC for TLS proof of concept Apr 30, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

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 introduces Post-Quantum Cryptography (PQC) support for gRPC and HTTP/JSON transports by integrating Conscrypt and enforcing specific TLS 1.3 named groups. It also adds a new pqc-test module to verify connectivity against PQC-enforcing servers. The review feedback identifies several critical issues: the modification of global JVM state (security providers and system properties) within library methods which can cause side effects for other application components, a missing dependency in the gax-grpc module, and a regression that breaks compatibility with non-Netty gRPC transports.

import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.Security;
import org.conscrypt.Conscrypt;
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.

critical

The import of org.conscrypt.Conscrypt will likely cause a compilation error as the conscrypt-openjdk-uber dependency is missing from the gax-grpc module's POM file (it was only added to gax-httpjson).

Comment on lines +830 to +833
Security.insertProviderAt(Conscrypt.newProvider(), 1);

// Force the use of the PQC algorithm group.
System.setProperty("jdk.tls.namedGroups", "X25519MLKEM768");
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.

high

Modifying global JVM state by calling Security.insertProviderAt and setting the jdk.tls.namedGroups system property inside a library method is problematic. These changes affect all TLS connections in the entire application, not just those created by this provider. This can lead to unexpected behavior or failures in other parts of the system that are not PQC-compatible. Consider making this configuration opt-in and scoped to the specific channel if possible.

Comment on lines +866 to +868
} else {
throw new IllegalStateException("Expected NettyChannelBuilder but got " + builder.getClass().getName());
}
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.

high

Throwing an IllegalStateException when the builder is not a NettyChannelBuilder breaks compatibility with other gRPC transport implementations (e.g., OkHttpChannelBuilder or InProcessChannelBuilder). Since applyPqcConfiguration is called by default, this change effectively prevents the use of any non-Netty transport. The PQC configuration should be applied gracefully or only when the transport supports it.

Comment on lines +189 to +190
java.security.Security.insertProviderAt(org.conscrypt.Conscrypt.newProvider(), 1);
System.setProperty("jdk.tls.namedGroups", "X25519MLKEM768");
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.

high

Modifying global security providers and system properties here affects the entire JVM. This should be avoided in library code to prevent side effects on other components.

Comment on lines +188 to +189
java.security.Security.insertProviderAt(org.conscrypt.Conscrypt.newProvider(), 1);
System.setProperty("jdk.tls.namedGroups", "X25519MLKEM768");
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.

high

Modifying global JVM state within a static factory method is a side effect that can impact other parts of the application. This configuration should be localized or made optional.

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