fix(security): remove full traceback from cron error output to prevent info leakage#5115
fix(security): remove full traceback from cron error output to prevent info leakage#5115memosr wants to merge 2 commits into
Conversation
|
Intent is correct — delivering full tracebacks to Telegram/Discord/Slack bleeds internal paths, library versions, and call stacks to recipients who may not be operators. The user's PR description flags the right concern. But the claim "Full traceback still available in local logs for developers" doesn't match what this PR does. Looking at the surrounding code: except Exception as e:
error_msg = f"{type(e).__name__}: {str(e)}"
logger.error("Job '%s' failed: %s", job_name, error_msg) # <-- only error_msg
# ...
output = f"... {error_msg} ...{traceback.format_exc()}" # <-- was hereThe only existing log call is Operators debugging cron job failures lose their primary diagnostic trail. A cron error report saying Fix: swap except Exception as e:
error_msg = f"{type(e).__name__}: {str(e)}"
logger.exception("Job '%s' failed", job_name) # logs traceback to log file
# ... deliver only error_msg in output (this PR's fix)
Dead import.
Minor — audit for other traceback leaks. The PR fixes this specific delivery path, but are there other places where cron job errors get formatted into user-facing output? Worth a grep across the cron scheduler and delivery pipeline to make sure this isn't a whack-a-mole situation. Summary: ship the delivery fix, but pair it with |
What does this PR do?
When a cron job fails, the error output sent to the delivery platform
includes the full Python traceback:
{error_msg}
{traceback.format_exc()}
A full traceback exposes:
/home/user/.hermes/...)This information is delivered to the configured platform (Telegram,
Discord, Slack, etc.) and could be seen by unintended recipients or
used by an attacker to fingerprint the system.
Fix
Removed
traceback.format_exc()from the delivered output. Theerror_msg(the exception message itself) is still included — itprovides enough context for the user to understand what went wrong
without leaking internal system details.
{error_msg}
Type of Change
Checklist