Skip to content

[FLINK-39635][security][rpc] Support comma-separated list in security.ssl.protocol#28160

Open
balassai wants to merge 3 commits into
apache:masterfrom
balassai:FLINK-39635
Open

[FLINK-39635][security][rpc] Support comma-separated list in security.ssl.protocol#28160
balassai wants to merge 3 commits into
apache:masterfrom
balassai:FLINK-39635

Conversation

@balassai
Copy link
Copy Markdown
Contributor

@balassai balassai commented May 14, 2026

What is the purpose of the change

security.ssl.protocol only accepted a single TLS version. This change allows a comma-separated list (e.g. "TLSv1.2,TLSv1.3") clusters can support multiple protocol versions at the same time.

Brief change log

  • SecurityOptions.SSL_PROTOCOL description updated to reflect comma-separated support
  • Pekko/Netty SSL config now sets protocol = TLS and passes the individual versions via enabled-protocols
  • CustomSSLEngineProvider overrides createServerSSLEngine/createClientSSLEngine to apply the enabled protocols

Verifying this change

This change added tests and can be verified as follows:

  • PekkoUtilsTest#getConfigSingleSslProtocolUsesGenericTlsContext — single value still works correctly
  • PekkoUtilsTest#getConfigCommaSeparatedSslProtocolsAreAllEnabled — comma-separated values are accepted

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: yes — affects TLS negotiation for internal RPC communication
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? docs / JavaDocs

Was generative AI tooling used to co-author this PR?
  • Yes (Cursor with Claude Sonnet 4.6)

@flinkbot
Copy link
Copy Markdown
Collaborator

flinkbot commented May 14, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Copy link
Copy Markdown
Contributor

@spuru9 spuru9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments.

Arrays.stream(sslProtocolsString.split(","))
.map(String::trim)
.toArray(String[]::new);
// Pekko's ConfigSSLEngineProvider uses the "protocol" field for both
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.

I believe this comment was generated by AI. Can we shorten it for readability?

Copy link
Copy Markdown
Contributor Author

@balassai balassai May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, removing the comment the method name is self explanatory.

throw new IllegalStateException("Failed to query supported TLS protocols from JVM", e);
}
final Set<String> configured = new HashSet<>(Arrays.asList(configuredProtocols));
// getSupportedSSLParameters().getProtocols() returns protocols from highest to lowest,
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.

The inline comment in the method body says the opposite of JavaDoc.

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.

removed the comment.

// so the first match in that list is the highest configured protocol.
return Arrays.stream(jvmOrdered)
.filter(configured::contains)
.findFirst()
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.

nit: SSLParameters.getProtocols() doesn't specify any ordering — OpenJDK happens to return descending (hardcoded in AbstractTLSContext) but others return ascending, in which case
findFirst() silently picks the lowest version and the user gets a TLSv1.3 → TLSv1.2 downgrade with no failing test.
Could we compare versions explicitly instead? e.g. .max(Comparator.comparingInt(this::tlsRank)) with a small regex parsing the TLSv{major}.{minor} digits.

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.

Thanks! Creating a comparator.

private static String highestSupportedProtocol(String[] configuredProtocols) {
final String[] jvmOrdered;
try {
SSLContext ctx = SSLContext.getInstance("TLS");
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.

nit(skippable): Could use SSLContext.getDefault().getSupportedSSLParameters().getProtocols() here — the default context is already initialized so it skips the getInstance + init(null,null,null) + try/catch dance. Same
result.

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.

Thanks! Using SSLContext.getDefault().getSupportedSSLParameters().getProtocols()

@github-actions github-actions Bot added the community-reviewed PR has been reviewed by the community. label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed PR has been reviewed by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants