Skip to content

Escape untrusted strings in notifications (2.4.1)#19

Merged
noxied merged 3 commits into
mainfrom
fix/notifier-escaping
Jun 13, 2026
Merged

Escape untrusted strings in notifications (2.4.1)#19
noxied merged 3 commits into
mainfrom
fix/notifier-escaping

Conversation

@noxied

@noxied noxied commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Security patch implementing the top finding from the comprehensive review.

Problem

Geo data from ipinfo.io (org/city/region/timezone) and GitHub release-note content were interpolated unescaped into HTML email, Telegram (parse_mode=HTML) and Discord markdown. This allowed markup/link injection into the notification channels, and a stray </& in the ISP org field made Telegram reject the message (400) and silently drop a real IP-change alert.

Fix

  • New shared wanwatcher/notifiers/_escape.py: html_escape (email), telegram_escape (HTML specials), discord_escape (markdown).
  • Applied to geo fields, server name, IP values, changelog content and release URL across the three HTML/markup notifiers, in change, update and event messages. Plain-text email and Apprise bodies are unchanged (no markup context).
  • 18 new tests assert hostile input is escaped, template tags survive, and the plain-text part stays raw.

No breaking changes. Full suite 330 passing, lint and mypy clean.

noxied added 3 commits June 13, 2026 08:03
Geo data from ipinfo.io and GitHub release notes were interpolated unescaped
into HTML email, Telegram (parse_mode=HTML) and Discord markdown. Add a shared
escape helper and apply it: html-escape for email, HTML-special escape for
Telegram, markdown escape for Discord, on geo fields, server name, IP values,
changelog content and release URL. Plain-text and Apprise paths are unchanged.

This blocks markup/link injection into the channels and fixes a case where a
stray < or & in a field made Telegram reject the message (400) and silently
drop a real IP-change alert.
Cover the escape helpers and assert each notifier escapes hostile geo, server
name, changelog and event strings while keeping the template tags intact; the
plain-text email part stays unescaped.
Bump to 2.4.1 and document the escaping fix in the changelog and upgrade notes.
@noxied noxied merged commit c06010b into main Jun 13, 2026
15 checks passed
@noxied noxied deleted the fix/notifier-escaping branch June 13, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant