feat: Refine run_as validation for dashboards to only disallow when…
#4408
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4394
This PR refines the run_as validation for dashboards. Previously, all dashboards were rejected when the bundle's run_as identity differed from the deployment user. Now, only dashboards with
embed_credentials: trueare rejected, as those embed the owner's credentials for query execution.Dashboards with
embed_credentials: false(the default) don't embed owner credentials - queries run under the viewer's credentials instead. Therefore, the run_as setting is irrelevant for these dashboards and they should be allowed.Changes
embed_credentials: trueembed_credentialsrequirementdashboardsto theallowListin tests since they're now conditionally allowedembed_credentials: true) and success case (embed_credentials: false)run_as/dashboard_embed_credentials/andrun_as/dashboard_no_embed/Why
The previous behavior was overly restrictive. According to the run_as documentation, run_as semantics apply to resources that execute code on behalf of a user. Dashboards with
embed_credentials: falsedon't embed the owner's credentials for query execution - they run queries using the viewer's credentials. This means run_as is irrelevant for such dashboards, and blocking deployment was unnecessarily preventing valid use cases.Tests
embed_credentials: truestill fail validationembed_credentials: falsepass validationacceptance/bundle/run_as/dashboard_embed_credentials/andacceptance/bundle/run_as/dashboard_no_embed/Run tests with: