New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sanitize flagging inputs before writing to csv #817
Conversation
gradio/utils.py
Outdated
| return data | ||
| elif isinstance(data, list) and isinstance(data[0], str): | ||
| sanitized_data = copy.deepcopy(data) | ||
| for i, item in enumerate(data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use index instead of i
gradio/utils.py
Outdated
|
|
||
| if isinstance(data, str): | ||
| if data.startswith(unsafe_prefixes): | ||
| warnings.warn("Sanitizing flagged data by escaping cell contents") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be nice to inform user about unsafe_prefixes
|
LGTM other than the points above, great work as always! |
Former-commit-id: 0a831a4
|
Awesome, thanks for the helpful suggestions |
Former-commit-id: 581f2c2
|
I'll hold off on merging until we resolve the big file issue |
To prevent csv injection, this sanitizes flagging inputs before writing to the csv