mikebridge opened a new pull request, #44900:
URL: https://github.com/apache/superset/pull/44900

   ### SUMMARY
   
   `GET /api/v1/chart/export/` returned a 500 when the caller could see a chart 
but did not have access to its dataset. `ExportDatasetsCommand` loads through 
`DatasetDAO`, whose base filter hides datasets the caller cannot access, so it 
raised `DatasetNotFoundError`; the chart export endpoint caught only 
`ChartNotFoundError`.
   
   The endpoint now maps `DatasetNotFoundError` to the same bare 404 
(`{"message": "Not found"}`) that the dataset export endpoint returns for this 
case. The response does not reveal whether the dataset exists, or its name or 
id, and no partial zip is returned: the handler sits inside the zip block.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A (API error mapping).
   
   ### TESTING INSTRUCTIONS
   
   - `pytest tests/unit_tests/charts/test_export_api.py`: the new test fails on 
master and passes here. It replaces the export command with one that yields a 
chart file and then raises, and asserts a 404 with the bare body.
   - Limit of that test: it proves the error mapping, not the access filtering 
itself. An integration test with a chart-owner principal who lacks the dataset 
grant would cover the real path and is a sensible follow-up.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Not covered here: dashboard export delegates to the same chart export 
command but catches only its own not-found errors, so an inaccessible nested 
dataset can still surface as a 500 there. That is a separate follow-up.
   
   🤖 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]

Reply via email to