gemini-code-assist[bot] commented on code in PR #18926:
URL: https://github.com/apache/tvm/pull/18926#discussion_r2981127998


##########
python/tvm/contrib/pickle_memoize.py:
##########
@@ -23,7 +23,6 @@
 import os
 import pathlib
 import sys

Review Comment:
   
![security-critical](https://www.gstatic.com/codereviewagent/security-critical.svg)
 ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   This PR removes the `warnings` import. To restore the security warning about 
`pickle` usage, this import is necessary.
   
   ```suggestion
   import sys
   import warnings
   ```



##########
python/tvm/contrib/pickle_memoize.py:
##########
@@ -72,13 +71,6 @@ def cache(self):
         if self.path.exists():
             with self.path.open("rb") as cache_file:
                 try:
-                    warnings.warn(
-                        f"Loading cached pickle file from {self.path}. "
-                        "Pickle files can execute arbitrary code. "
-                        "Only load cache files you trust.",
-                        UserWarning,
-                        stacklevel=2,
-                    )
                     cache = pickle.load(cache_file)

Review Comment:
   
![security-critical](https://www.gstatic.com/codereviewagent/security-critical.svg)
 ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   Reverting this change removes a crucial security warning about the dangers 
of loading pickle files. Deserializing data with `pickle` from an untrusted 
source can lead to arbitrary code execution. This warning should be restored to 
inform users of the potential security risk. If the warning was causing issues 
(e.g., being too noisy), it could be controlled by an environment variable or a 
configuration option rather than being removed entirely.
   
   ```suggestion
                       warnings.warn(
                           f"Loading cached pickle file from {self.path}. "
                           "Pickle files can execute arbitrary code. "
                           "Only load cache files you trust.",
                           UserWarning,
                           stacklevel=2,
                       )
                       cache = pickle.load(cache_file)
   ```



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