Jason Fehr has posted comments on this change. ( 
https://gerrit.cloudera.org/25247 )

Change subject: IMPALA-14331: Support proxy for JWKS URL download
......................................................................


Patch Set 3:

(16 comments)

https://gerrit.cloudera.org/#/c/25247/2/be/src/kudu/util/curl_util.cc
File be/src/kudu/util/curl_util.cc:

https://gerrit.cloudera.org/#/c/25247/2/be/src/kudu/util/curl_util.cc@280
PS2, Line 280:   if (!proxy_.empty()) {
> Done. Added set_proxy_pinned_public_key() to EasyCurl and a new jwksProxyPi
Done


https://gerrit.cloudera.org/#/c/25247/2/be/src/kudu/util/curl_util.cc@300
PS2, Line 300:     }
> Done, it's set whenever noproxy_ isn't empty now.
Done


https://gerrit.cloudera.org/#/c/25247/2/be/src/util/jwt-util.cc
File be/src/util/jwt-util.cc:

https://gerrit.cloudera.org/#/c/25247/2/be/src/util/jwt-util.cc@837
PS2, Line 837:     return nullptr;
             :   }
> Done
Done


https://gerrit.cloudera.org/#/c/25247/3/be/src/util/jwt-util.cc
File be/src/util/jwt-util.cc:

https://gerrit.cloudera.org/#/c/25247/3/be/src/util/jwt-util.cc@751
PS3, Line 751:     curl.set_proxy(jwks_proxy);
Opus finding:  Need the ability to set the 
https://curl.se/libcurl/c/CURLOPT_PROXY_CAPATH.html option so a different CA 
bundle path can be specified for the proxy.

I recommend this approach:
Add a new jwks_proxy_ca_certificate field (alongside jwks_proxy and 
jwks_proxy_pinned_public_key).  If this field is specified, use its value for 
the CURLOPT_PROXY_CAPATH curl option.  If this field is specified with a blank 
value, do not set the CURLOPT_PROXY_CAPATH option.  If the new 
jwks_proxy_ca_certificate field is not specified, use the value of the 
jwks_ca_certificate field for the CURLOPT_PROXY_CAPATH curl option (if that 
field is specified).  If neither jwks_ca_certificate nor 
jwks_proxy_ca_certificate is specified, then do not set CURLOPT_PROXY_CAPATH.


https://gerrit.cloudera.org/#/c/25247/3/be/src/util/jwt-util.cc@758
PS3, Line 758:   KUDU_RETURN_IF_ERROR(curl.FetchURL(jwks_url, &dst), 
jwks_proxy.empty() ?
Opus found this call could still include the jwks_url (which would include 
username/password) since curl.FetchURL() will use the CURL_RETURN_NOT_OK() 
macro which includes curl's error buffer `errbuf_`.

Details:
A typo in the proxy URL is the most likely way to hit this. The full message 
then goes into the startup error and the Failed to load JWKS log line. The test 
LoadJwksUrlProxyErrorOmitsCredentials only covers "connection refused", where 
libcurl doesn't print the URL, so it misses this.

Suggested Fix: redact the whole message, or only append errbuf when the proxy 
URL has no user info. Add a test with a bad scheme and credentials.


https://gerrit.cloudera.org/#/c/25247/2/be/src/util/oauth-server-config.cc
File be/src/util/oauth-server-config.cc:

https://gerrit.cloudera.org/#/c/25247/2/be/src/util/oauth-server-config.cc@97
PS2, Line 97: Status ValidateJwksProxy(const OAuthServerConfig& config) {
> Yes, I removed the custom parser and libcurl validates it now. A bad value
Done


https://gerrit.cloudera.org/#/c/25247/2/be/src/util/oauth-server-config.cc@119
PS2, Line 119:     std::string* value_out) {
> Done, any value is accepted, credentials included
Done


https://gerrit.cloudera.org/#/c/25247/3/be/src/util/oauth-server-config.cc
File be/src/util/oauth-server-config.cc:

https://gerrit.cloudera.org/#/c/25247/3/be/src/util/oauth-server-config.cc@52
PS3, Line 52: jwksProxy
Opus reported the possibility of exposing the proxy username/password.

Details:
--oauth_servers is not tagged sensitive, and the new field invites user:pass@ 
in its value. Both LogCommandLineFlags and the /varz page use 
CheckFlagAndRedact, which only hides flags tagged sensitive. So the password is 
written to the INFO log at every startup and shown on the debug web UI.

Suggested Fix Options:
1. Tag oauth_servers as sensitive using the TAG_FLAG(..., sensitive) macro. 
This hides the whole config, which makes debugging harder.
2. Add a separate field for the password, e.g. jwksProxyPasswordCmd, set with 
CURLOPT_PROXYPASSWORD, and reject or document against credentials in jwksProxy.


https://gerrit.cloudera.org/#/c/25247/3/be/src/util/oauth-server-config.cc@101
PS3, Line 101:   if (!config.jwks_proxy_pinned_public_key.empty() && 
config.jwks_proxy.empty()) {
Opus finding: ValidateJwksProxy only checks that jwksProxy is non-empty, so a 
user who sets a pin gets no protection and no warning. Fix: reject 
jwksProxyPinnedPublicKey unless the proxy scheme is https:// 
(case-insensitive), and add a unit test for that.


https://gerrit.cloudera.org/#/c/25247/2/tests/custom_cluster/test_shell_oauth_servers_auth.py
File tests/custom_cluster/test_shell_oauth_servers_auth.py:

https://gerrit.cloudera.org/#/c/25247/2/tests/custom_cluster/test_shell_oauth_servers_auth.py@175
PS2, Line 175:     result = run_impala_shell_cmd(vector, args)
> Done. I merged them in and removed the old class.
Done


https://gerrit.cloudera.org/#/c/25247/2/tests/custom_cluster/test_shell_oauth_servers_auth.py@258
PS2, Line 258:     impalad_timeout_s=60,
> Added test_jwks_url_through_https_proxy_with_untrusted_cert_fails.
Done


https://gerrit.cloudera.org/#/c/25247/3/tests/custom_cluster/test_shell_oauth_servers_auth.py
File tests/custom_cluster/test_shell_oauth_servers_auth.py:

https://gerrit.cloudera.org/#/c/25247/3/tests/custom_cluster/test_shell_oauth_servers_auth.py@36
PS3, Line 36: JWKS_HTTP_PORT = 31371
            : JWKS_HTTPS_PORT = 31372
            : HTTP_PROXY_PORT = 31373
            : HTTPS_PROXY_PORT = 31374
            : SOCKS5_PROXY_PORT = 31375
            : TUNNEL_PROXY_PORT = 31376
            : UNUSED_PORT = 31379
If any of these ports are in-use, the tests will fail.  Implement logic to 
check for unused ports first.


https://gerrit.cloudera.org/#/c/25247/3/tests/custom_cluster/test_shell_oauth_servers_auth.py@104
PS3, Line 104:     super(TestImpalaShellOAuthServersAuth, cls).setup_class()
Opus finding: if any of these servers fails to start, all previously started 
servers continue to run.  Suggested fix: catch exceptions and shut down all 
running servers.


https://gerrit.cloudera.org/#/c/25247/3/tests/custom_cluster/test_shell_oauth_servers_auth.py@122
PS3, Line 122:       server.stop()
An exception stopping a server will leave the rest of the servers running.  
Catch exceptions, log them, and move to the next server.


https://gerrit.cloudera.org/#/c/25247/3/tests/custom_cluster/test_shell_oauth_servers_auth.py@209
PS3, Line 209:   @pytest.mark.execute_serially
Opus suggestion for test to add:
Missing coverage: no test for an https identity provider reached through an 
https proxy (TLS inside TLS).


https://gerrit.cloudera.org/#/c/25247/2/tests/util/proxy_servers.py
File tests/util/proxy_servers.py:

https://gerrit.cloudera.org/#/c/25247/2/tests/util/proxy_servers.py@18
PS2, Line 18: # Minimal in-process HTTP, HTTPS and SOCKS5 proxies for tests.
            : #
            : # Every proxy forwards all connections to a single fixed backend 
address, regardless of
            : # the destination requested by the client, and records the 
requested destinations. This
            : # lets tests use unresolvable host names in URLs to prove that 
requests went through the
            : # proxy.
            :
> Done
Done



--
To view, visit https://gerrit.cloudera.org/25247
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6741b8e107f707d3fcc0a9e15ac01b5769191924
Gerrit-Change-Number: 25247
Gerrit-PatchSet: 3
Gerrit-Owner: Anubhav Jindal <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Anubhav Jindal <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jason Fehr <[email protected]>
Gerrit-Comment-Date: Sat, 14 Nov 2026 00:10:50 +0000
Gerrit-HasComments: Yes

Reply via email to