fix: safer error message in alerts (#27019)

This commit is contained in:
Beto Dealmeida 2024-02-07 14:58:51 -05:00 committed by GitHub
parent c77fc7dbaf
commit 686ce33ea5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -150,7 +150,7 @@ class AlertCommand(BaseCommand):
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,
)
@ -169,7 +169,12 @@ class AlertCommand(BaseCommand):
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:
"""