Skip to content

[SPARK-54293][SQL] Disable SNI host check in ThriftHttpCLIService#55308

Open
yadavay-amzn wants to merge 2 commits intoapache:masterfrom
yadavay-amzn:fix/SPARK-54293-sni-host-check
Open

[SPARK-54293][SQL] Disable SNI host check in ThriftHttpCLIService#55308
yadavay-amzn wants to merge 2 commits intoapache:masterfrom
yadavay-amzn:fix/SPARK-54293-sni-host-check

Conversation

@yadavay-amzn
Copy link
Copy Markdown

@yadavay-amzn yadavay-amzn commented Apr 11, 2026

What changes were proposed in this pull request?

Disable SNI host check in ThriftHttpCLIService by adding a SecureRequestCustomizer with setSniHostCheck(false) to the Jetty SSL connector configuration.

This is the same fix that was applied to JettyUtils.scala in SPARK-45522 when Spark upgraded from Jetty 9 to Jetty 10, but was missed for ThriftHttpCLIService.

Why are the changes needed?

Since Jetty 10, SniHostCheck defaults to true. This was disabled in the Spark UI server (SPARK-45522) but not in ThriftHttpCLIService, which also creates a Jetty server with SSL support. Without this fix, the Hive Thrift HTTP server may reject HTTPS connections when the SNI hostname does not match the certificate.

Note on RestSubmissionServer: The JIRA also mentions RestSubmissionServer, but after reviewing the code, it has no SSL support — it only creates plain HTTP connectors. The SNI host check only applies to HTTPS, so RestSubmissionServer does not need this fix.

Does this PR introduce any user-facing change?

No. This restores the pre-Jetty 10 behavior where SNI host check was not enforced.

How was this patch tested?

Added ThriftHttpCLIServiceSuite with two tests:

  • Verifies that SSL connection factories with the fix have SecureRequestCustomizer.sniHostCheck set to false.
  • Verifies that without the fix (default Jetty 10+ behavior), sniHostCheck is true, confirming the bug.

Was this patch authored or co-authored using generative AI tooling?

Yes

@yadavay-amzn yadavay-amzn force-pushed the fix/SPARK-54293-sni-host-check branch 2 times, most recently from 1a3a880 to 1f7e24c Compare April 27, 2026 22:35
@yadavay-amzn
Copy link
Copy Markdown
Author

@LuciferYang Could you take a look when you get a chance? Thanks!

Arrays.toString(sslContextFactoryServer.getExcludeProtocols()));
sslContextFactoryServer.setKeyStorePath(keyStorePath);
sslContextFactoryServer.setKeyStorePassword(keyStorePassword);
// SPARK-54293: Disable SNI host check, which defaults to true since Jetty 10.
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.

also cc @pan3793

@pan3793
Copy link
Copy Markdown
Member

pan3793 commented May 5, 2026

can we follow SPARK-56528 (#55396) to make it configurable?

Anupam Yadav added 2 commits May 5, 2026 20:51
Disable SNI host check in ThriftHttpCLIService's Jetty SSL connector,
consistent with the fix applied to JettyUtils.scala in SPARK-45522.

Since Jetty 10, SniHostCheck defaults to true. This was fixed in the
Spark UI server but not in ThriftHttpCLIService, which also creates a
Jetty server with SSL support.

Note: RestSubmissionServer (also mentioned in the JIRA) does not have
SSL support, so it does not need this fix.
Address review feedback from @pan3793 (PR apache#55308): follow the pattern
established in SPARK-56528 and make the SNI host check configurable
rather than unconditionally disabled.

Introduces spark.sql.hive.thriftServer.http.sniHostCheckEnabled
(default: false, preserving the behavior from the first commit on
this branch). Operators who want stricter host checking for security
can opt in by setting the flag to true.
@yadavay-amzn yadavay-amzn force-pushed the fix/SPARK-54293-sni-host-check branch from 1f7e24c to 63c708a Compare May 6, 2026 18:39
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.

3 participants