oliver-zehentleitner / maity

clean-up: web board/messages: link crash in the card panel, raw role tokens, one forge-link helper, swallowed errors

Sign in to report

tsk-pzx7bdc3a3d1 Open

From the web clean-up audit, area 17 (tsk-hgnbapyw7hnh), read at 80647565 (findings sent to lotse, seq 125512). Line numbers are from 80647565, so re-check them on current main. #30 and #33 are user-visible bugs.

#30 Card panel / board: a link the hub accepts can crash the card panel (bug).

  • card-panel.js:123-126 (linkItem) checks the URL with its own /^https:\/\// test and then calls h("a", {href: url}). board.js:313 has the same check.
  • h() throws a TypeError for any href that M.dom.safeUrl rejects (dom.js:33-34).
  • safeUrl also refuses the HIDDEN characters (dom.js:117: DEL, zero-width, bidi). The hub link check (hub board/links.py:77-89) only refuses whitespace, characters below 0x20 and user info.
  • So a member-added kind:url link containing, for example, U+200B is stored by the hub, and render() then throws. The whole panel fails to draw.
  • Proposal: use M.dom.safeUrl(url) in both places, as overview.js already does. Add a smoke case with such a link.
  • Effort S. Risk very low.

#33 Messages / Inbox: role and trust addressees are shown as raw tokens (bug).

  • messages.js:35 shows "role:slug" untranslated. There is no trust: branch, so a message sent to trust:owner falls through to memberRef(ctx, "trust:owner") and shows the raw token.
  • inbox.js:86-88 prints "role {role}" and "trust {trust}" raw.
  • inbox.js:200 formats the card status with .replace("_", " ") instead of M.dom.word("status").
  • M.trust.tokenWords (trust.js:122) exists, and project-message.js:87 already uses it.
  • Proposal: route both views through tokenWords and M.dom.word, and drop the keys messages.to.role, inbox.to.role and inbox.to.trust.
  • Effort S. Risk low.

#31 Overview / Messages / Board: the forge URL is built four ways, and the board ignores GitLab (duplication/design).

  • Where:
  • overview.js:68-76 (contractUrl)
  • messages.js:49-55 (commitUrl)
  • board.js:309-315 (whyLine)
  • ids.js:44 (forgeBase, GitHub only, used only inside ids.js)
  • app.js:289/294 (pullsUrl/actionsUrl)
  • Each strips .git and the trailing slash itself, in two different orders. app.js and board.js strip the slash first, so a URL ending in "r.git/" keeps its .git in messages and overview.
  • board.js always builds the GitHub /blob/ path, so a GitLab repository gets a wrong link.
  • Proposal: one M.ids.forgePage(repo, kind, ref, path) on top of safeUrl, used by all five, with forgeBase folded in.
  • Effort S. Risk low: smoke href assertions.

#38 Board / project message / board-edit: errors swallowed as "nothing there" (debt).

  • board.js:1418: M.api.get(card) with a .catch that returns null turns any failure (offline, 403, 5xx) into "card not in the last 14 days".
  • project-message.js:37: getAll(tasks...) with a .catch that returns an empty list leaves the card picker silently empty. It also pages through every open card just to fill a dropdown.
  • board-edit.js:232: a failed /roles read is dropped silently. app.js:1137 does the same (tsk-58cxde7nt4be).
  • Proposal: treat only 404 as missing, and show other failures in the status line.
  • Effort S. Risk low.

Order: tsk-rzhydxnsav4m (repository URL on any forge host) has a web PR still to come that touches the same forge links. Do #31 after it or together with it, so the helper covers "other" forges.