Repository navigation
v0.5.0 — security fixes for untrusted tag data, clickable tags, container-shaped clouds
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.
hrefaccepted any scheme and was assigned straight to the anchor, sojavascript: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.colorwas 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()andvar()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
onTagClickon every adapter (tagClickoutput in Angular, an option onmount()/renderTagCloud()). Non-link tags render as<button type="button">— focusable, keyboard-operable, correctly announced — with no visual change. Links still fire it, sopreventDefault()can take over routing. Nothing becomes focusable without a handler.density(0–1, default0.5):0distributes terms evenly across the container,1packs them tightly around the centre leaving the corners empty. Terms never overlap at any setting.SECURITY.mdandCONTRIBUTING.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 (
densitydefaults to0.5). - Tooltips no longer default to the raw weight — "95" means nothing to a visitor.
item.titlestill sets one;ariaLabelgives the explained form.
🐛 Fixed
- Duplicate labels crashed the Svelte adapter. Two tags sharing a
labelwith noidthreweach_key_duplicateand took down the component. Keys are now de-duplicated (Java,Java#2, …). mount()exposessetFill(), matchingrenderTagCloud(), and<otc-tag-cloud>adjustsfillin 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.mdships 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, /coreFull changelog: v0.4.2...v0.5.0