Copilot commented on code in PR #40658:
URL: https://github.com/apache/superset/pull/40658#discussion_r3338099925
##########
superset/charts/data/api.py:
##########
@@ -747,7 +747,10 @@ def _create_streaming_csv_response(
# Create response with streaming headers
response = Response(
csv_generator_callable(), # Call the callable to get generator
- mimetype=f"text/csv; charset={encoding}",
+ # Use content_type (not mimetype) so the charset is set verbatim;
+ # passing a charset via mimetype makes Werkzeug append a second
+ # charset, producing a malformed doubled Content-Type header.
+ content_type=f"text/csv; charset={encoding}",
headers={
"Content-Disposition": f'attachment; filename="{filename}"',
Review Comment:
`filename` can come from `request.form` (via
`_extract_export_params_from_request`) and is interpolated directly into the
`Content-Disposition` header. If a client supplies unexpected characters, this
can yield an invalid header value (and Werkzeug may raise), and it
unnecessarily trusts user-provided input for a response header. Consider
sanitizing before interpolation (e.g., `secure_filename`) or otherwise
validating allowed characters.
--
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]