Re: [PR] fix: add safety warning to pickle_memoize cache loading [tvm]

2026-03-24 Thread via GitHub


scruge1 commented on PR #18925:
URL: https://github.com/apache/tvm/pull/18925#issuecomment-4120770275

   Understood — the revert in #18926 is appropriate given TVM's trusted-data 
security model. Thank you for the consideration.


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



Re: [PR] fix: add safety warning to pickle_memoize cache loading [tvm]

2026-03-24 Thread via GitHub


scruge1 commented on PR #18925:
URL: https://github.com/apache/tvm/pull/18925#issuecomment-4117930427

   Understood — makes sense that pickle_memoize operates within TVM's 
trusted-data security model. Closing this PR. Thank you for the review.


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



Re: [PR] fix: add safety warning to pickle_memoize cache loading [tvm]

2026-03-24 Thread via GitHub


tqchen commented on PR #18925:
URL: https://github.com/apache/tvm/pull/18925#issuecomment-4117725108

   given pickle is used as part of our code and our security model assumes 
trusted data, we would prefer not having a warning in such case


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



Re: [PR] fix: add safety warning to pickle_memoize cache loading [tvm]

2026-03-23 Thread via GitHub


tlopex merged PR #18925:
URL: https://github.com/apache/tvm/pull/18925


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



Re: [PR] fix: add safety warning to pickle_memoize cache loading [tvm]

2026-03-23 Thread via GitHub


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


##
python/tvm/contrib/pickle_memoize.py:
##
@@ -71,6 +71,14 @@ def cache(self):
 if self.path.exists():
 with self.path.open("rb") as cache_file:
 try:
+import warnings

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The `import warnings` statement should be moved to the top of the file. 
According to PEP 8, imports should be at the top of the file, just after any 
module comments and docstrings. Placing imports inside functions is generally 
discouraged as it makes it harder to see the module's dependencies at a glance 
and can lead to repeated imports.
   
   
   References
   
   1. PEP 8 recommends that imports are always put at the top of the file, just 
after any module comments and docstrings, and before module globals and 
constants. 
([link](http://console.cloud.google.com/gemini-code-assist/agents-tools))
   



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



Re: [PR] fix: add safety warning to pickle_memoize cache loading [tvm]

2026-03-23 Thread via GitHub


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


##
python/tvm/contrib/pickle_memoize.py:
##
@@ -71,6 +71,14 @@ def cache(self):
 if self.path.exists():
 with self.path.open("rb") as cache_file:
 try:
+import warnings

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   To adhere to PEP 8 guidelines, import statements should be placed at the top 
of the file. Please move `import warnings` to the top of the module.
   
   
   References
   
   1. PEP 8, the style guide for Python code, specifies that imports should be 
at the top of the file. This improves readability and makes dependencies 
explicit. 
([link](https://github.com/apache/tvm/blob/main/.gemini/styleguide.md))
   



##
python/tvm/contrib/pickle_memoize.py:
##
@@ -71,6 +71,14 @@ def cache(self):
 if self.path.exists():
 with self.path.open("rb") as cache_file:
 try:
+import warnings
+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,
+)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   This change introduces a user warning, which is great for security 
awareness. However, there is no test to verify that this warning is actually 
triggered when loading from a cached pickle file. Please consider adding a test 
case to `tests/python/contrib/test_memoize.py` that uses `pytest.warns` to 
assert that the `UserWarning` is raised.



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



Re: [PR] fix: add safety warning to pickle_memoize cache loading [tvm]

2026-03-23 Thread via GitHub


gemini-code-assist[bot] commented on PR #18925:
URL: https://github.com/apache/tvm/pull/18925#issuecomment-4114378289

   ## Summary of Changes
   
   Hello, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request 
and will post my feedback shortly. In the meantime, here's a summary to help 
you and other reviewers quickly get up to speed!
   
   This pull request addresses a security vulnerability (CWE-502: 
Deserialization of Untrusted Data) in the `pickle_memoize` utility. It enhances 
user awareness by adding a `UserWarning` during the loading of cached pickle 
files, informing them that pickle files can execute arbitrary code and should 
only be loaded from trusted sources. This change aims to mitigate risks where 
malicious payloads could be injected into the cache directory.
   
   ### Highlights
   
   * **Security Warning Added**: A `UserWarning` has been introduced in 
`pickle_memoize` to alert users about the security risks associated with 
loading cached pickle files, specifically the potential for arbitrary code 
execution from untrusted sources.
   
   🧠 **New Feature in Public Preview:** You can now enable **Memory** to help 
**Gemini Code Assist** learn from your team's feedback. This makes future code 
reviews more consistent and personalized to your project's style. **Click 
[here](https://codeassist.google/code-review/login) to enable Memory in your 
admin console.**
   
   
   Using Gemini Code Assist
   
   
   The full guide for Gemini Code Assist can be found on our [documentation 
page](https://developers.google.com/gemini-code-assist/docs/review-github-code),
 here are some quick tips.
   
   Invoking Gemini
   
   You can request assistance from Gemini at any point by creating a comment 
using either `/gemini ` or `@gemini-code-assist `. Below is a 
summary of the supported commands on the current page.
   
   Feature | Command | Description
   --- | --- | ---
   Code Review | `/gemini review` | Performs a code review for the current pull 
request in its current state.
   Pull Request Summary | `/gemini summary` | Provides a summary of the current 
pull request in its current state.
   Comment | @gemini-code-assist | Responds in comments when explicitly tagged, 
both in pull request comments and review comments.
   Help | `/gemini help` | Displays a list of available commands.
   
   Customization
   
   To customize Gemini Code Assist for GitHub experience, repository 
maintainers can create a configuration file and/or provide a custom code review 
style guide (such as PEP-8 for Python) by creating and adding files to a 
`.gemini/` folder in the base of the repository. Detailed instructions can be 
found 
[here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   Limitations & Feedback
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances 
where its feedback is incorrect or counter productive. You can react with 
:thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're 
interested in giving your feedback about your experience with Gemini Code 
Assist for GitHub and other Google products, sign up 
[here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), 
[Generative AI Prohibited Use 
Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of 
Service](https://policies.google.com/terms), and learn how to configure Gemini 
Code Assist in GitHub 
[here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
 Gemini can make mistakes, so double check it and [use code with 
caution](https://support.google.com/legal/answer/13505487).
   


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