Hi all, Any chart, filter or dashboard can ask the database for an open or very long time range. On large tables that is a common way for a single chart to become an expensive query, and today an admin has no way to cap it.
#46038 <https://github.com/apache/superset/pull/46038> adds time range limits for chart queries: a longest range, an earliest start and a latest end. Deployment config sets the global limits, and dataset and dashboard editors can add stricter ones. It is behind a new flag, TIME_RANGE_LIMITS, off by default. https://github.com/apache/superset/pull/46038 With the flag off, chart queries run as today and the new endpoints are off; the only remaining check is that a stored dashboard value has the right shape. No migration; `superset init` registers one new permission for a read-only admin page. Design choices: - The strictest applicable limit wins; editors can only tighten. - The server checks before cache, async and SQL: 400 TIME_RANGE_LIMIT_ERROR, and 503 when a stored policy is invalid. - The longest range counts back from the range end, like "Last N months", so presets of the same length pass. - Filter value lists with no time range read the latest allowed window instead of being exempt. - Dashboard copies and imports never change time ranges silently: they list the changes and apply them only after the user confirms. - It protects databases, not data: no access control, and SQL Lab and alert SQL are not checked. If there are no objections by Monday, December 1, I'll consider this approved by lazy consensus and continue with the review on the PR. Happy to answer questions here or on the PR. Thanks, Damian Pendrak
