Skip to content

0.9.0

Choose a tag to compare

@ronison ronison released this 12 Nov 13:27
· 31 commits to main since this release

What's Changed

Security hardening

This release hardens the rendering pipeline against untrusted input:

  • XSS: untrusted text is now escaped in every legacy painter, so SVG/HTML output is safe even when the human-readable label contains markup characters.
  • Text cap: text longer than 4000 characters (globally settable/resettable via setMaxTextLength/resetMaxTextLength) now throws the library's checked exceptions instead of producing unbounded output — in both Java and Node.
  • RenderSpec bounds: barWidth (≤ 100), barHeight (≤ 10 000) and moduleSize (≤ 100) are validated in Java and Node, with integer checks on the Node side.
  • Code 128 is encoded with a fixed charset (ISO-8859-1) in both implementations, removing platform-dependent default-charset behaviour.
  • CI: all GitHub Actions are pinned by commit SHA and npm is pinned to 11.5.1 in the workflows.
  • Registry: register() no longer allows shadowing a registered format id, and id normalisation uses an explicit locale (Locale.ROOT) in Java.
  • module-info exports are narrowed to the public API surface.

Rendering fixes

  • EAN/UPC labels are padded defensively before fixed-offset substring calls, so short labels can no longer crash with StringIndexOutOfBoundsException.
  • The human-readable text area now honours the RenderSpec background via a new spec-aware paintTextSvg / paintTextWithSpec (previously hardcoded #fff, which broke the visual on dark backgrounds) — in both pipelines.
  • SVG output emits preserveAspectRatio="xMidYMid meet" and normalises #fff to #ffffff (goldens regenerated accordingly).

Improved

  • The user RenderSpec is now fully propagated through the Node linear format: colours from the user spec reach the bar renderers and the text renderers, matching the Java behaviour end-to-end.
  • The Node package-lock.json is back in sync with package.json.

Tests

  • SecurityHardeningTest (12 tests) covers the spec bounds, the text cap, the registry rule, label padding and legacy XSS escaping.
  • A new Node test verifies spec colours in the raster pixels and SVG fills — 729 Java tests + the performance integration test, 98 Node tests, all green.

Full Changelog: pr-0.8.0...pr-0.9.0