You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "haje01 (via GitHub)" <gi...@apache.org> on 2025/08/22 03:01:30 UTC
[PR] fix(query_context_processor): apply CSV encoding to follow the encoding settings of 'CSV_EXPORT' [superset]
haje01 opened a new pull request, #34806:
URL: https://github.com/apache/superset/pull/34806
### SUMMARY
The encoding issue when exporting CSV from sql_lab was resolved by https://github.com/apache/superset/pull/34235, but the encoding issue when exporting CSV from dashboard graphs still remains. This PR fixes that issue.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
1. Click the three-dot icon on any dashboard graph and select Download / Export to .CSV
2. Open the downloaded file in vim's hex mode to check if BOM (Byte Order Mark) is attached
### ADDITIONAL INFORMATION
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(query_context_processor): apply CSV encoding to follow the encoding settings of 'CSV_EXPORT' [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #34806:
URL: https://github.com/apache/superset/pull/34806#issuecomment-4041988610
This PR hasn't been updated in a long time and has several CI failures (pre-commit, test-mysql, test-postgres, test-sqlite). The test failures are likely caused by the `.encode()` call changing the result type from `str` to `bytes`, which may break downstream callers. We'll mark it as draft for now — please investigate the test failures, fix the type issue, rebase against `master`, and set it back to 'ready for review' when it's ready.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(query_context_processor): apply CSV encoding to follow the encoding settings of 'CSV_EXPORT' [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #34806:
URL: https://github.com/apache/superset/pull/34806
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(query_context_processor): apply CSV encoding to follow the encoding settings of 'CSV_EXPORT' [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #34806:
URL: https://github.com/apache/superset/pull/34806#issuecomment-4700528396
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(query_context_processor): apply CSV encoding to follow the encoding settings of 'CSV_EXPORT' [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #34806:
URL: https://github.com/apache/superset/pull/34806#discussion_r2292588053
##########
superset/common/query_context_processor.py:
##########
@@ -1001,6 +1001,7 @@ def get_data(
result = csv.df_to_escaped_csv(
df, index=include_index, **current_app.config["CSV_EXPORT"]
)
+ result = result.encode(current_app.config["CSV_EXPORT"].get("encoding", "utf-8"))
Review Comment:
### Unvalidated encoding configuration for CSV export <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The code uses a configuration value for encoding CSV data without validation, which could potentially lead to security issues if the configuration is tampered with.
###### Why this matters
If an attacker can manipulate the CSV_EXPORT configuration to specify a malicious encoding, it could result in data corruption or potential code execution vulnerabilities when the CSV is later processed by other systems.
###### Suggested change ∙ *Feature Preview*
```python
# Add encoding validation
valid_encodings = {'utf-8', 'ascii', 'iso-8859-1'} # Define allowed encodings
encoding = current_app.config["CSV_EXPORT"].get("encoding", "utf-8")
if encoding not in valid_encodings:
encoding = "utf-8" # Default to utf-8 if invalid
result = result.encode(encoding)
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5f1e64c3-ffc8-4aa5-b506-796baf05901a/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5f1e64c3-ffc8-4aa5-b506-796baf05901a?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5f1e64c3-ffc8-4aa5-b506-796baf05901a?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5f1e64c3-ffc8-4aa5-b506-796baf05901a?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5f1e64c3-ffc8-4aa5-b506-796baf05901a)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:896233d5-3d7c-4ec5-ae27-c0689beaa53b -->
[](896233d5-3d7c-4ec5-ae27-c0689beaa53b)
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(query_context_processor): apply CSV encoding to follow the encoding settings of 'CSV_EXPORT' [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #34806:
URL: https://github.com/apache/superset/pull/34806#issuecomment-4701162169
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/34806?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `4 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 55.57%. Comparing base ([`e7ecf54`](https://app.codecov.io/gh/apache/superset/commit/e7ecf5479afafca5edfa5610384e5801ef40f7f8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`d4d54a3`](https://app.codecov.io/gh/apache/superset/commit/d4d54a3cda961dd2a693efdbac3e77b73a8091b1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/34806?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/charts/data/api.py](https://app.codecov.io/gh/apache/superset/pull/34806?src=pr&el=tree&filepath=superset%2Fcharts%2Fdata%2Fapi.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/34806?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/common/query\_context\_processor.py](https://app.codecov.io/gh/apache/superset/pull/34806?src=pr&el=tree&filepath=superset%2Fcommon%2Fquery_context_processor.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHRfcHJvY2Vzc29yLnB5) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/34806?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (e7ecf54) and HEAD (d4d54a3). Click for more details.
>
> <details><summary>HEAD has 90 uploads less than BASE</summary>
>
>| Flag | BASE (e7ecf54) | HEAD (d4d54a3) |
>|------|------|------|
>|python|79|1|
>|presto|13|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #34806 +/- ##
==========================================
- Coverage 64.27% 55.57% -8.70%
==========================================
Files 2660 2660
Lines 144585 144587 +2
Branches 33338 33339 +1
==========================================
- Hits 92926 80353 -12573
- Misses 50023 63511 +13488
+ Partials 1636 723 -913
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/34806/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/34806/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/34806/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/34806/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/34806/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.96% <0.00%> (-0.01%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/34806/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.96% <0.00%> (-18.66%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/34806/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/34806/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/34806?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org