Skip to content

v0.5.0 — security fixes for untrusted tag data, clickable tags, container-shaped clouds

Choose a tag to compare

@hkoren hkoren released this 10 Aug 00:51
· 47 commits to main since this release
db027fa

Two security fixes for untrusted tag data, clickable tags, and layout controls. All seven packages are at 0.5.0 with SLSA provenance.

🔒 Security

Tag data is frequently user-generated, and two TagCloudItem fields reached the DOM unvalidated.

  • href accepted any scheme and was assigned straight to the anchor, so javascript:alert(1) was click-to-XSS in the vanilla renderer and the Svelte, Vue and Solid adapters (React blocks it; Angular sanitizes). Only relative URLs and safe schemes (http, https, mailto, tel, ftp, sms) now become links; anything else renders as text. Whitespace and control characters spliced into a scheme are stripped before it's read, since browsers ignore them.
  • color was interpolated into a style string, so a ; closed the custom property and appended declarations — red;background-image:url(//evil.test/p.png) made the browser fetch an attacker URL. Colors are now restricted to the characters CSS colors need; hex, rgb()/hsl()/oklch()/color-mix() and var() all still work.

Both are validated in one place, so every renderer inherits them. class and id remain trusted input — SECURITY.md documents the full boundary, and private vulnerability reporting is now enabled.

✨ Added

  • onTagClick on every adapter (tagClick output in Angular, an option on mount()/renderTagCloud()). Non-link tags render as <button type="button"> — focusable, keyboard-operable, correctly announced — with no visual change. Links still fire it, so preventDefault() can take over routing. Nothing becomes focusable without a handler.
  • density (0–1, default 0.5): 0 distributes terms evenly across the container, 1 packs them tightly around the centre leaving the corners empty. Terms never overlap at any setting.
  • SECURITY.md and CONTRIBUTING.md.

🔄 Changed

  • Clouds take their container's aspect ratio. Each term's growth front is stretched to the box, so a wide container gets a wide elliptical cloud instead of a circle floating in the middle. On a 3.6:1 container the cloud's aspect went from ~1.25 to ~3.5.
  • The default arrangement is slightly clustered (density defaults to 0.5).
  • Tooltips no longer default to the raw weight — "95" means nothing to a visitor. item.title still sets one; ariaLabel gives the explained form.

🐛 Fixed

  • Duplicate labels crashed the Svelte adapter. Two tags sharing a label with no id threw each_key_duplicate and took down the component. Keys are now de-duplicated (Java, Java#2, …).
  • mount() exposes setFill(), matching renderTagCloud(), and <otc-tag-cloud> adjusts fill in place rather than remounting (which discarded the packed layout and its animation).
  • Published packages now contain the MIT LICENSE — every package declared it, none shipped it. CHANGELOG.md ships too.

⬆️ Upgrading

Layouts will look different: clouds are shaped to their container and slightly clustered by default. density={0} restores the previous even spread, though the elliptical shaping stays. Unsafe href/color values are dropped rather than rendered, and tooltips no longer show a weight number.

npm install opentagcloud          # Svelte 5 + vanilla mount() + <otc-tag-cloud>
npm install @opentagcloud/react   # or /vue, /angular, /solid, /next, /core

Full changelog: v0.4.2...v0.5.0