rusackas opened a new pull request, #41017: URL: https://github.com/apache/superset/pull/41017
### SUMMARY A failing (test-only) unit test reproducing #32768. On an embedded dashboard, a guest who applies a **Time Grain** native filter that differs from the chart's default grain hits `Guest user cannot modify chart payload` and the chart fails to load. **Root cause.** A chart with a generic x-axis bakes the selected time grain *into* the `BASE_AXIS` adhoc column as a `timeGrain` property — `normalizeTimeColumn` (`superset-frontend/packages/superset-ui-core/src/query/normalizeTimeColumn.ts`) copies `extras.time_grain_sqla` onto the column. So when a guest picks a different grain via a native filter, the change travels inside the request's `columns` array. The guest tamper-guard `query_context_modified` (`superset/security/manager.py`) frozen-compares the requested `columns`/`metrics`/`groupby`/`orderby` against the stored chart values. The grain-mutated column is no longer a subset of the stored columns, so the guard returns `True` → `raise_for_access` raises `Guest user cannot modify chart payload`. A Time Grain native filter is a supported, read-only guest interaction — it only changes the granularity at which the *same* dimension is bucketed; it never exposes different metrics or columns. So the guard is over-broad here. This PR only adds the failing test that pins the expected behavior. It intentionally does **not** include a fix, so reviewers can confirm the reproduction first and agree on the right place to relax the guard (e.g. ignore the `timeGrain` of a `BASE_AXIS` column when comparing). ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — test-only. ### TESTING INSTRUCTIONS ```bash pytest "tests/unit_tests/security/manager_test.py::test_query_context_modified_time_grain_native_filter" ``` The test is **expected to FAIL on current `master`** (`assert not True` — `query_context_modified` returns `True` for a pure time-grain change). It will pass once the guard ignores a `BASE_AXIS` column's `timeGrain` when checking for payload tampering. The six existing `test_query_context_modified*` tests continue to pass. ### ADDITIONAL INFORMATION - [x] Has associated issue: #32768 - [ ] 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]
