You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "villebro (via GitHub)" <gi...@apache.org> on 2026/10/15 18:42:08 UTC

[PR] feat(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

villebro opened a new pull request, #45355:
URL: https://github.com/apache/superset/pull/45355

   ### SUMMARY
   The WebSocket server could only connect to a standalone Redis/Valkey, with TLS limited to the default trust store and no way to configure a CA, client certificate, or Sentinel. The Python coordination backend supports standalone and Sentinel, each with full TLS options, and the two must point at the same Redis/Valkey. This brings the Node server to parity.
   
   - **TLS:** `sslCaCerts` (`REDIS_SSL_CA_CERTS`) is trusted in addition to Node's public CA roots, matching Python's behavior, so public and private CAs work together. With no CA configured, public CAs already work with just `ssl: true`. `sslCertfile`/`sslKeyfile` enable mutual TLS. `sslCertReqs` accepts `required`, `optional` or `none`; only `none` skips verification (for a TLS client Python's `optional` is equivalent to `required`), and an invalid value falls back to `required`.
   - **Hostname validation:** `validateHostname` now has a `REDIS_VALIDATE_HOSTNAME` env override. Previously it could only be set in `config.json`, which the container images don't use.
   - **Sentinel:** setting `sentinels` (`REDIS_SENTINELS=host:port,...`) enables Sentinel mode, with `sentinelMaster` (required) and `sentinelPassword`. `failoverDetector` is enabled so the Pub/Sub subscriber drops a demoted master and re-resolves the new one. As on the Python side, TLS applies to the resolved master and the sentinel nodes are contacted in plaintext.
   - A missing cert file fails fast at startup.
   
   Redis Cluster is not supported by either side. Socket timeouts and `force_master_ip` have no equivalent here; ioredis defaults apply.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A
   
   ### TESTING INSTRUCTIONS
   `cd superset-websocket && npm test`. New unit tests cover `buildRedisOpts` (standalone, TLS, custom CA plus public roots using real temp PEM files, missing cert file, Sentinel, missing master name) and the new env overrides. To verify manually, start the server with `REDIS_SENTINELS`/`REDIS_SENTINEL_MASTER` against a Sentinel setup, or with `REDIS_SSL=true` and `REDIS_SSL_CA_CERTS` against a TLS-enabled Valkey, and confirm `/ready` returns 200.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #45355:
URL: https://github.com/apache/superset/pull/45355#issuecomment-6204452217

   ### <span aria-hidden="true">โœ…</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">๐Ÿ”จ</span> Latest commit | 884d91858585e9f5dece2b5b009d1b380f2e171b |
   |<span aria-hidden="true">๐Ÿ”</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6ad161bf580d15d37da71a98 |
   |<span aria-hidden="true">๐Ÿ˜Ž</span> Deploy Preview | [https://deploy-preview-45355--superset-docs-preview.netlify.app](https://deploy-preview-45355--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">๐Ÿ“ฑ</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQ1MzU1LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.njZiWWBfEYz8qfBoBuW8WMZ87-gyFADLdD2C4-5Z_IA)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">๐Ÿค–</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcpBCoAgEADAv-w5KYnM-kHPUHcjSVvRKCL6e97mMC-kzDGdMAM0YLM53FZ9-RDIZm5vsoXdTqfIhL6IyEilTqQU-FmwXmVQKmnXQXcoB-xHNKM0k4bvBw) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-45355--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #45355:
URL: https://github.com/apache/superset/pull/45355#discussion_r4288270328


##########
superset-websocket/src/config.ts:
##########
@@ -134,6 +164,41 @@ const toStringArray = (s: string) =>
     .map(entry => entry.trim())
     .filter(entry => entry.length > 0);
 
+// Parse "host:port,host:port" (IPv6 hosts as "[::1]:26379"). A missing port
+// defaults to the Sentinel port; an unparseable entry is skipped with a warning.
+function toSentinelNodes(s: string): SentinelNode[] {
+  return toStringArray(s).flatMap(entry => {
+    const sep = entry.lastIndexOf(':');
+    const hasPort = sep > 0 && !entry.endsWith(']');
+    const host = (hasPort ? entry.slice(0, sep) : entry).replace(
+      /^\[|\]$/g,
+      '',
+    );
+    const port = hasPort ? Number(entry.slice(sep + 1)) : 26379;
+    if (!host || !Number.isInteger(port) || port <= 0) {

Review Comment:
   โœ… **CodeAnt verified this suggestion was addressed in subsequent commits and marked this thread resolved** as of `c62a420`.
   
   The Sentinel port validation now rejects ports above 65535 before returning the node.
   
   <sub>If that's not right, unresolve this thread and CodeAnt will leave it open.</sub>
   
   <!-- codeant-auto-resolve-reply -->



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #45355:
URL: https://github.com/apache/superset/pull/45355#discussion_r4287026889


##########
superset-websocket/src/config.ts:
##########
@@ -134,6 +164,41 @@ const toStringArray = (s: string) =>
     .map(entry => entry.trim())
     .filter(entry => entry.length > 0);
 
+// Parse "host:port,host:port" (IPv6 hosts as "[::1]:26379"). A missing port
+// defaults to the Sentinel port; an unparseable entry is skipped with a warning.
+function toSentinelNodes(s: string): SentinelNode[] {
+  return toStringArray(s).flatMap(entry => {
+    const sep = entry.lastIndexOf(':');
+    const hasPort = sep > 0 && !entry.endsWith(']');
+    const host = (hasPort ? entry.slice(0, sep) : entry).replace(
+      /^\[|\]$/g,
+      '',
+    );
+    const port = hasPort ? Number(entry.slice(sep + 1)) : 26379;
+    if (!host || !Number.isInteger(port) || port <= 0) {

Review Comment:
   **Suggestion:** Ports above 65535 pass this check and reach ioredis, where TCP rejects them, leaving that Sentinel node unable to connect despite being accepted as valid.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely` ยท ๐Ÿท๏ธ `Logic error`
   
   [![Use CodeAnt Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill) [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=0186b9990ac14345a0280014670beaee&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=0186b9990ac14345a0280014670beaee&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-websocket/src/config.ts
   **Line:** 178:178
   **Comment:**
   	*Logic Error: Ports above 65535 pass this check and reach ioredis, where TCP rejects them, leaving that Sentinel node unable to connect despite being accepted as valid.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45355&comment_hash=86813cd634da16646cd288695cb653585dd1a08af3cbf8be5879585099b1ed21&reaction=like'>๐Ÿ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45355&comment_hash=86813cd634da16646cd288695cb653585dd1a08af3cbf8be5879585099b1ed21&reaction=dislike'>๐Ÿ‘Ž</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on PR #45355:
URL: https://github.com/apache/superset/pull/45355#issuecomment-6204544385

   Scoping update: I removed the `sentinelSsl` option again in ffb92c7bd8. TLS to Sentinel nodes isn't supported by the Python backend either, so adding it only on the WebSocket side would diverge from it. This PR keeps parity (TLS to the resolved master via `ssl`, plaintext sentinels), and TLS to sentinel nodes will follow in a separate `feat` PR covering both sides.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on PR #45355:
URL: https://github.com/apache/superset/pull/45355#issuecomment-6204475027

   Follow-up to the Sentinel TLS discussion above: the sentinel nodes were also left in plaintext (copied from the Python backend's limitation), which can't work in a TLS-only deployment. Added `sentinelSsl` / `REDIS_SENTINEL_SSL` in e757bff623; `ssl` secures the master and `sentinelSsl` the sentinel nodes, using the same CA/client-cert/verification settings. It defaults to `false`, so existing plaintext-sentinel setups are unchanged. Also removed the test that asserted TLS master with plaintext sentinels.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #45355:
URL: https://github.com/apache/superset/pull/45355#discussion_r4288262502


##########
superset-websocket/src/config.ts:
##########
@@ -134,6 +164,41 @@ const toStringArray = (s: string) =>
     .map(entry => entry.trim())
     .filter(entry => entry.length > 0);
 
+// Parse "host:port,host:port" (IPv6 hosts as "[::1]:26379"). A missing port
+// defaults to the Sentinel port; an unparseable entry is skipped with a warning.
+function toSentinelNodes(s: string): SentinelNode[] {
+  return toStringArray(s).flatMap(entry => {
+    const sep = entry.lastIndexOf(':');
+    const hasPort = sep > 0 && !entry.endsWith(']');
+    const host = (hasPort ? entry.slice(0, sep) : entry).replace(
+      /^\[|\]$/g,
+      '',
+    );
+    const port = hasPort ? Number(entry.slice(sep + 1)) : 26379;
+    if (!host || !Number.isInteger(port) || port <= 0) {

Review Comment:
   Good catch, fixed in c62a420527: ports above 65535 are now ignored with a warning, and the env-override test covers a `toobig:70000` entry.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on PR #45355:
URL: https://github.com/apache/superset/pull/45355#issuecomment-6204429348

   Thanks @madhushreeag, you're right. In ioredis 6's `SentinelConnector`, `tls` is only applied to the resolved master when `enableTLSForSentinelMode` is set; otherwise it uses a plain `net.createConnection`, so `ssl: true` was silently ignored in Sentinel mode and my test locked that in. Fixed in 884d918585: the flag is now set whenever `ssl` and `sentinels` are both configured, and the test asserts it. Sentinel nodes themselves still use `sentinelTLS` (unset), so they remain plaintext as on the Python side.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro merged PR #45355:
URL: https://github.com/apache/superset/pull/45355


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(websocket): support Sentinel and full TLS options for Redis/Valkey [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45355:
URL: https://github.com/apache/superset/pull/45355#issuecomment-6199852797

   ## CodeAnt PR Risk: Medium Risk
   
   - The PR needs attention before merging: Sentinel port validation accepts values above the valid TCP port range.
   - An out-of-range port is passed to ioredis, so a misconfigured Sentinel endpoint may prevent Redis connectivity.
   
   **Assessed commit:** `69b82b26b059`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org