bito-code-review[bot] commented on PR #40863:
URL: https://github.com/apache/superset/pull/40863#issuecomment-4651789845

   <!-- Bito Reply -->
   The current implementation in `superset/viz.py` does not validate that 
`deck_slices` is a list, which could lead to issues if a non-list value is 
provided. Additionally, the configuration access for 
`VIZ_DECK_SLICES_MAX_LIST_SIZE` should use `.get(..., 0)` to prevent potential 
`KeyError` exceptions if the key is missing. 
   
   To address these, you should update the code to verify the type of 
`slice_ids` and use a safer configuration lookup:
   
   ```python
           slice_ids = self.form_data.get("deck_slices")
           if not isinstance(slice_ids, list):
               slice_ids = []
   
           max_deck_slices = 
current_app.config.get("VIZ_DECK_SLICES_MAX_LIST_SIZE", 0)
           if max_deck_slices and len(slice_ids) > max_deck_slices:
               # ... validation logic ...
   ```
   
   **superset/viz.py**
   ```
   slice_ids = self.form_data.get("deck_slices")
           if not isinstance(slice_ids, list):
               slice_ids = []
   
           max_deck_slices = 
current_app.config.get("VIZ_DECK_SLICES_MAX_LIST_SIZE", 0)
           if max_deck_slices and len(slice_ids) > max_deck_slices:
   ```


-- 
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