rusackas opened a new pull request, #40658:
URL: https://github.com/apache/superset/pull/40658
### SUMMARY
Two Content-Type construction issues (CWE-116 / ASVS 4.1.1):
1. **Streaming CSV export** (`superset/charts/data/api.py`) passed
`mimetype=f"text/csv; charset={encoding}"` to Flask's `Response`. Werkzeug
appends its own default charset to the `mimetype` value, producing a **doubled,
malformed** header — `Content-Type: text/csv; charset=utf-8; charset=utf-8`.
Switched to `content_type=`, which is used verbatim. (Reproduced on the pinned
Werkzeug 3.x.)
2. **`json_success` and `BaseSupersetView.json_response`**
(`superset/views/base.py`) returned `application/json` with no charset,
inconsistent with `_send_chart_response`. Set `content_type="application/json;
charset=utf-8"`.
Updated the one test that asserted the exact `application/json` content type.
(Note: the related FINDING-024 — `X-Content-Type-Options: nosniff` on chart
screenshots — is **not** included: Flask-Talisman already sets that header
globally, so it's a false positive.)
### TESTING INSTRUCTIONS
```
pytest tests/integration_tests/charts/api_tests.py -k
get_data_no_query_context
```
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]