Files
wekan/models/lib
Lauri Ojansivu 9cbf67ba7c Fix 8 GitHub CodeQL code-scanning alerts: incomplete escaping, URL
substring check, an overly-permissive regex range and a no-op replace.

- models/lib/cardUrlAutolink.js and packages/markdown/src/
  template-integration.js (kept in sync, per their own comments): the
  card-title markdown-link escape only escaped ']', not the backslash
  that precedes it, so a title ending in a raw backslash escaped the
  ']' this code inserts to close the label instead of the label
  actually closing. Escape '\' before ']'.
- server/lib/documentGif.js: plainSearchText's control-character strip
  used literal raw control bytes inside the regex character class
  instead of \x escapes, so CodeQL flagged the range as unverifiable
  (adjacent control bytes are visually indistinguishable, so a
  boundary could silently shift). Rewritten with explicit \x escapes,
  byte-for-byte equivalent to the original range.
- tests/notificationEmailUrlLink.test.cjs: built a dynamic RegExp by
  hand-escaping only '/', leaving every other meta-character -
  including backslash itself - unescaped. Added the same escapeRegExp
  helper already used elsewhere in the codebase.
- tests/oauthLogoutUrl.test.cjs: asserted a returned URL did not
  contain a hostname via `.includes()`, a substring check a
  confusable/query-embedded hostname can fool either way. Compare the
  parsed `new URL().hostname` instead.
- tests/boardCreationAdminOnly.test.cjs: `.replace(/ /g, ' ')` was a
  no-op (replacing a space with itself); the actual intent was to
  collapse runs of spaces, `.replace(/ +/g, ' ')`.

Every fix has a positive test proving the corrected behaviour and a
negative test reproducing the exact bypass/bug CodeQL flagged. None of
these cross a security boundary on their own (the markdown-link title
escaping is a rendering-correctness fix - DOMPurify still sanitizes
the final HTML regardless, per the existing code comments; the rest
are test-only assertion bugs), so no Admin Panel security-log entry
applies.

Thanks to GitHub CodeQL and xet7 !
2026-09-10 21:20:46 +03:00
..
2026-06-06 07:21:59 +03:00
2026-06-06 09:28:05 +03:00