Skip to content

fix(chart-data): return 403 for SupersetSecurityException in chart data API#41865

Merged
hainenber merged 2 commits into
apache:masterfrom
durgaprasadml:fix/report-csv-http-500-41862
Jul 9, 2026
Merged

fix(chart-data): return 403 for SupersetSecurityException in chart data API#41865
hainenber merged 2 commits into
apache:masterfrom
durgaprasadml:fix/report-csv-http-500-41862

Conversation

@durgaprasadml

Copy link
Copy Markdown
Contributor

SUMMARY

This change ensures that chart data API endpoints consistently return HTTP 403 Forbidden when a SupersetSecurityException is raised during request validation.

Previously, these exceptions were not explicitly handled, allowing them to propagate as an internal server error (HTTP 500). This resulted in callers, including the Alerts & Reports CSV generation flow, receiving an unexpected 500 response instead of the appropriate authorization error.

This patch adds explicit handling for SupersetSecurityException in the affected chart data API endpoints by returning response_403(), aligning their behavior with other protected Superset endpoints.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable.

TESTING INSTRUCTIONS

  1. Trigger a chart data request that raises a SupersetSecurityException.
  2. Verify the API returns HTTP 403 Forbidden instead of HTTP 500 Internal Server Error.
  3. Verify authorized requests continue to return chart data successfully.
  4. Verify existing chart data endpoints continue to behave as expected.

ADDITIONAL INFORMATION

@dosubot dosubot Bot added alert-reports Namespace | Anything related to the Alert & Reports feature api:charts Related to the REST endpoints of charts authentication:access-control Rlated to access control labels Jul 7, 2026
@bito-code-review

bito-code-review Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #24ca65

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 1256661..1256661
    • superset/charts/data/api.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

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 documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the api Related to the REST API label Jul 7, 2026
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.65%. Comparing base (8108496) to head (10f34b9).
⚠️ Report is 35 commits behind head on master.

Files with missing lines Patch % Lines
superset/charts/data/api.py 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #41865      +/-   ##
==========================================
- Coverage   64.70%   64.65%   -0.06%     
==========================================
  Files        2701     2702       +1     
  Lines      149843   150141     +298     
  Branches    34501    34553      +52     
==========================================
+ Hits        96962    97067     +105     
- Misses      51103    51285     +182     
- Partials     1778     1789      +11     
Flag Coverage Δ
hive 39.06% <0.00%> (-0.11%) ⬇️
mysql 57.56% <33.33%> (-0.13%) ⬇️
postgres 57.62% <33.33%> (-0.13%) ⬇️
presto 40.57% <0.00%> (-0.11%) ⬇️
python 59.05% <33.33%> (-0.10%) ⬇️
sqlite 57.21% <33.33%> (-0.13%) ⬇️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread superset/charts/data/api.py
Comment thread superset/charts/data/api.py
@pull-request-size pull-request-size Bot added size/S and removed size/XS labels Jul 8, 2026
@netlify

netlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 10f34b9
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a4e716b7b06860008288d5d
😎 Deploy Preview https://deploy-preview-41865--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review

bito-code-review Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #50f104

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 1256661..10f34b9
    • superset/charts/data/api.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

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 documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@hainenber

Copy link
Copy Markdown
Contributor

Thank you for the contribution

@hainenber hainenber merged commit 227b3a4 into apache:master Jul 9, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alert-reports Namespace | Anything related to the Alert & Reports feature api:charts Related to the REST endpoints of charts api Related to the REST API authentication:access-control Rlated to access control size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alerts/Reports sending chart as csv fails with HTTP 500

2 participants