Commit Graph
1 Commits
Author SHA1 Message Date
Lauri Ojansivu a7ae58ea9f Fix CodeQL alert 547: check the Trello link by its parsed host, not as a substring.
CodeQL js/incomplete-url-substring-sanitization flagged
tests/vietnameseBulgarianCompletion.test.cjs: the Kashubian trello-api-key
translation was checked with includes('https://trello.com/app-key'), which
also passes for https://evil.example/?x=https://trello.com/app-key or a
lookalike host. The test now extracts each link from the text, parses it,
and requires the hostname trello.com and the path /app-key.

A new tree-wide suite, tests/urlSubstringSanitization.test.cjs, fails on any
URL or host literal checked with includes(), or with indexOf()/search() used
as a yes/no test, in source and tests alike; it skips comments and template
literals with interpolation (not constants), proves it recognises the
reported line and the earlier #531 form, and checks the new form rejects a
link in the query, in the path and on a lookalike host. No shipped code had
the substring form - the alert was in a test - so there is no Hall of Fame
row or Problems key.

Thanks to GitHub CodeQL and xet7 !
2026-10-01 19:43:24 +03:00