bito-code-review[bot] commented on code in PR #26040:
URL: https://github.com/apache/superset/pull/26040#discussion_r3343463322


##########
helm/superset/values.yaml:
##########
@@ -288,6 +288,7 @@ supersetNode:
     redis_ssl:
       enabled: false
       ssl_cert_reqs: CERT_NONE
+    redis_driver: "redis"

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing env var wiring</b></div>
   <div id="fix">
   
   The `redis_driver` value is added to `values.yaml` but not exported as 
`REDIS_DRIVER` environment variable in `secret-env.yaml`. Meanwhile, 
`_helpers.tpl` (lines 116-120) reads `env('REDIS_DRIVER')` without a default. 
All other redis connection values (host, port, user, password, proto, db, ssl) 
are explicitly exported in `secret-env.yaml` lines 35-45. Without this wiring, 
the Celery `broker_url`/`result_backend` will fail at render time.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- helm/superset/templates/secret-env.yaml
    +++ helm/superset/templates/secret-env.yaml
    @@ -42,6 +42,7 @@ stringData:
         REDIS_SSL_CERT_REQS: {{ 
.Values.supersetNode.connections.redis_ssl.ssl_cert_reqs | default "CERT_NONE" 
| quote }}
         {{- end }}
         REDIS_CELERY_DB: {{ .Values.supersetNode.connections.redis_celery_db | 
quote }}
    +    REDIS_DRIVER: {{ .Values.supersetNode.connections.redis_driver | quote 
}}
         DB_HOST: {{ tpl .Values.supersetNode.connections.db_host . | quote }}
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #9dd70e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
helm/superset/templates/_helpers.tpl:
##########
@@ -112,8 +112,13 @@ SQLALCHEMY_TRACK_MODIFICATIONS = True
 
 class CeleryConfig:
   imports  = ("superset.sql_lab", )
-  broker_url = CELERY_REDIS_URL
-  result_backend = CELERY_REDIS_URL
+  {{- if .Values.supersetNode.connections.redis_password }}
+  broker_url = 
f"{env('REDIS_DRIVER')}://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
+  result_backend = 
f"{env('REDIS_DRIVER')}://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
+  {{- else }}
+  broker_url = 
f"{env('REDIS_DRIVER')}://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
+  result_backend = 
f"{env('REDIS_DRIVER')}://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
+  {{- end }}

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>CWE-20: Undefined Env Var + Missing SSL</b></div>
   <div id="fix">
   
   The new f-strings use `env('REDIS_DRIVER')` which is never defined in 
secret-env.yaml (only `REDIS_PROTO` exists). Additionally, SSL query parameters 
from `REDIS_URL_PARAMS` are missing, so SSL-enabled Redis connections will fail 
for Celery. (See also: [CWE-20](https://cwe.mitre.org/data/definitions/20.html))
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- helm/superset/templates/_helpers.tpl (lines 113-123)
    @@
     class CeleryConfig:
       imports  = ("superset.sql_lab", )
    -  {{- if .Values.supersetNode.connections.redis_password }}
    -  broker_url = 
f"{env('REDIS_DRIVER')}://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
    -  result_backend = 
f"{env('REDIS_DRIVER')}://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
    -  {{- else }}
    -  broker_url = 
f"{env('REDIS_DRIVER')}://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
    -  result_backend = 
f"{env('REDIS_DRIVER')}://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
    -  {{- end }}
    +  {{- if .Values.supersetNode.connections.redis_password }}
    +  broker_url = CELERY_REDIS_URL
    +  result_backend = CELERY_REDIS_URL
    +  {{- else }}
    +  broker_url = CELERY_REDIS_URL
    +  result_backend = CELERY_REDIS_URL
    +  {{- end }}
     CELERY_CONFIG = CeleryConfig
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #9dd70e</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to