bito-code-review[bot] commented on PR #43666: URL: https://github.com/apache/superset/pull/43666#issuecomment-5459089078
<!-- Bito Reply --> The flagged issue correctly identifies a potential race condition where a concurrent update could bypass CSS validation. To resolve this, you should perform the validation and the update within a database transaction that uses a row-level lock (e.g., `SELECT ... FOR UPDATE`). In `superset/commands/dashboard/update.py`, you can modify the `run` method to lock the dashboard row before performing the validation and update: ```python # Inside UpdateDashboardCommand.run() from superset.extensions import db # Lock the row for update dashboard = db.session.query(Dashboard).with_for_update().get(self._model.id) # Perform validation and update within the same transaction self.validate() DashboardDAO.update(dashboard, self._properties) ``` Would you like me to fetch all other comments on this PR to validate them and implement fixes for those as well? **superset/commands/dashboard/update.py** ``` # Inside UpdateDashboardCommand.run() from superset.extensions import db # Lock the row for update dashboard = db.session.query(Dashboard).with_for_update().get(self._model.id) # Perform validation and update within the same transaction self.validate() DashboardDAO.update(dashboard, self._properties) ``` -- 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]
