Skip to content

Commit 3bd5149

Browse files
committed
test(telegram): tighten link-URL assertion to silence CodeQL
Address CodeQL alert on PR #89: ``"wikipedia.org" in result`` matches an arbitrary substring and tripped the URL-substring-sanitization heuristic. Replace with a longer anchored fragment ``"https://en.wikipedia.org/wiki/Foo_"`` which both passes CodeQL and is a stronger render assertion. This is test-only — no behavior change, no security boundary. https://claude.ai/code/session_01FyMxQn2BEAzmwKS1GZczKj
1 parent b1eea39 commit 3bd5149

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/test_telegram_format.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,10 @@ def test_link_url_only_escapes_paren_and_backslash(self):
283283
result = converter.from_ast(converter.to_ast("[wiki](https://en.wikipedia.org/wiki/Foo_(bar))"))
284284
# The inner `)` from `(bar)` must be escaped to `\)`.
285285
assert "\\)" in result
286-
# The `.` in `wikipedia.org` should NOT be escaped inside the URL.
287-
assert "wikipedia.org" in result
286+
# The `.` in the host should NOT be escaped inside the URL — assert
287+
# via a long anchored fragment so CodeQL's URL-substring heuristic
288+
# isn't tripped (this is a render check, not a security boundary).
289+
assert "https://en.wikipedia.org/wiki/Foo_" in result
288290

289291
def test_render_postable_string_passes_through_unchanged(self):
290292
# Plain string messages ship verbatim — no escaping (parse_mode

0 commit comments

Comments
 (0)