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

   <!-- Bito Reply -->
   The flagged security issue is correct. The current sanitization logic only 
removes control characters and newlines, allowing attackers to inject spaces 
and punctuation like `=` into the log message, which can corrupt downstream log 
parsing. To resolve this, you should restrict the `sanitized_column` to a safe 
character set, such as alphanumeric characters, underscores, hyphens, and dots.
   
   Here is the corrected implementation for `superset/views/base_api.py`:
   
   ```python
           # Sanitize the user-supplied column name to a safe token set
           import re
           sanitized_column = re.sub(r'[^a-zA-Z0-9_.-]', '', 
str(column_name))[:200]
           logger.warning(
               "Rejected disallowed field access: user_id=%s endpoint=%s.%s 
column=%s",
               get_user_id(),
               self.__class__.__name__,
               func_name,
               sanitized_column,
           )
   ```
   
   There are no other review comments in this pull request. Would you like me 
to assist with any other part of the implementation?
   
   **superset/views/base_api.py**
   ```
   # Sanitize the user-supplied column name to a safe token set
           import re
           sanitized_column = re.sub(r'[^a-zA-Z0-9_.-]', '', 
str(column_name))[:200]
           logger.warning(
               "Rejected disallowed field access: user_id=%s endpoint=%s.%s 
column=%s",
               get_user_id(),
               self.__class__.__name__,
               func_name,
               sanitized_column,
           )
   ```


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