rusackas commented on code in PR #43666:
URL: https://github.com/apache/superset/pull/43666#discussion_r3885180319
##########
superset/commands/dashboard/update.py:
##########
@@ -130,6 +131,19 @@ def validate(self) -> None:
except ValidationError as ex:
exceptions.append(ex)
+ # A dashboard PUT resends the full object on every save, so only
+ # validate css when it's actually changing -- otherwise a dashboard
+ # whose existing css predates this check (or was imported without
+ # going through it) becomes uneditable for unrelated changes like a
+ # rename or a chart move.
+ if "css" in self._properties:
+ new_css = self._properties["css"]
+ if new_css != self._model.css:
+ try:
+ validate_css(new_css)
Review Comment:
This read-then-write window exists for every field on this command, not just
css, it's the general lost-update pattern for any PUT here. Row locking to
close it would be a bigger change than this PR's scope (closing the css
validation gap itself).
--
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]