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


##########
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><div>
   
   
   <div id="suggestion">
   <div id="issue"><b>CeleryConfig SSL params missing</b></div>
   <div id="fix">
   
   Please append `{REDIS_URL_PARAMS}` to both `broker_url` and `result_backend` 
f-strings in `CeleryConfig` so SSL query parameters are included, matching the 
pattern used by `CACHE_REDIS_URL`.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #aa5466</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