Skip to content

Avoid leaking exception details to Telegram in triage error notifications #186

@mmx003

Description

@mmx003

Summary

triage_issue() passes str(exc) directly into the Telegram error notification (triage.py:837). Exception messages can contain server paths, internal URLs, command-line arguments, or env var names — all of which end up visible in the Telegram chat.

Details

The current flow:

except Exception as exc:
    log.exception("Triage failed for %s#%d", ...)  # good — full details in logs
    await _send_error_notification(metadata, str(exc), ...)  # problem — full details to Telegram

_send_error_notification builds the text as:

text = f"Issue triage failed for {metadata.repo}#{metadata.number}: {error_detail}"

Depending on the exception type, str(exc) may expose:

  • Server filesystem paths (FileNotFoundError, PermissionError)
  • Internal URLs and ports (ConnectionError, aiohttp.ClientError)
  • Subprocess command-line arguments

With GITHUB_NOTIFY_CHAT_ID (#182), these messages now reach group chats too.

Suggested fix

Send only the exception type name to Telegram — log.exception() already captures the full details:

await _send_error_notification(
    metadata,
    type(exc).__name__,  # e.g. "TimeoutError", not the full message
    webhook_port,
    webhook_secret,
    notify_chat_id,
)

The same pattern should be checked in review.py if it has a similar notification path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions