Skip to content

Commit

Permalink
fix: safer error message in alerts (apache#27019)
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida authored and sfirke committed Mar 22, 2024
1 parent 348022b commit acd2602
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions superset/commands/report/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _execute_query(self) -> pd.DataFrame:
rendered_sql, ALERT_SQL_LIMIT
)

_, username = get_executor(
executor, username = get_executor( # pylint: disable=unused-variable
executor_types=app.config["ALERT_REPORTS_EXECUTE_AS"],
model=self._report_schedule,
)
Expand All @@ -169,7 +169,12 @@ def _execute_query(self) -> pd.DataFrame:
logger.warning("A timeout occurred while executing the alert query: %s", ex)
raise AlertQueryTimeout() from ex
except Exception as ex:
raise AlertQueryError(message=str(ex)) from ex
logger.exception("An error occurred when running alert query")
# The exception message here can reveal to much information to malicious
# users, so we raise a generic message.
raise AlertQueryError(
message=_("An error occurred when running alert query")
) from ex

def validate(self) -> None:
"""
Expand Down

0 comments on commit acd2602

Please sign in to comment.