diff --git a/CHANGELOG.md b/CHANGELOG.md index 7634a96..30f9f94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ * Hide fee/fine action menu items when requester is virtual user. Refs UICHKIN-398. * Hide “Item details” option in Actions menu when item is virtual. Refs UICHKIN-403. +## [9.0.3] (https://github.com/folio-org/ui-checkin/tree/v9.0.3) (2024-03-27) +[Full Changelog](https://github.com/folio-org/ui-checkin/compare/v9.0.2...v9.0.3) +* Add support for Barcode tag with sanitize. Refs UICHKIN-421, UICHKIN-422. + +## [9.0.2] (https://github.com/folio-org/ui-checkin/tree/v9.0.2) (2024-03-24) +[Full Changelog](https://github.com/folio-org/ui-checkin/compare/v9.0.1...v9.0.2) +* Only certain HTML tags should be rendered when displaying staff slips. Refs UICHKIN-421, UICHKIN-422. ## [9.0.1] (https://github.com/folio-org/ui-checkin/tree/v9.0.1) (2023-10-23) [Full Changelog](https://github.com/folio-org/ui-checkin/compare/v9.0.0...v9.0.1) diff --git a/package.json b/package.json index 3cefa78..30e68dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@folio/checkin", - "version": "9.0.1", + "version": "9.0.3", "description": "Item Check-in", "repository": "folio-org/ui-checkin", "publishConfig": { @@ -94,6 +94,7 @@ }, "dependencies": { "dateformat": "^2.0.0", + "dompurify": "^3.0.9", "final-form": "^4.19.1", "html-to-react": "^1.3.3", "inactivity-timer": "^1.0.0", diff --git a/src/components/ComponentToPrint/ComponentToPrint.js b/src/components/ComponentToPrint/ComponentToPrint.js index 0899058..5debbbc 100644 --- a/src/components/ComponentToPrint/ComponentToPrint.js +++ b/src/components/ComponentToPrint/ComponentToPrint.js @@ -2,6 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import HtmlToReact, { Parser } from 'html-to-react'; import Barcode from 'react-barcode'; +import { sanitize } from 'dompurify'; + import { buildTemplate } from '../../util'; export const shouldProcessNode = node => node.name === 'barcode'; @@ -39,7 +41,7 @@ class ComponentToPrint extends React.Component { const { dataSource, } = this.props; - const componentStr = this.template(dataSource); + const componentStr = sanitize(this.template(dataSource), { ADD_TAGS: ['Barcode'] }); const Component = this.parser.parseWithInstructions(componentStr, () => true, this.rules) || null; return ( diff --git a/src/components/ComponentToPrint/ComponentToPrint.test.js b/src/components/ComponentToPrint/ComponentToPrint.test.js index 09641e7..85ab0a3 100644 --- a/src/components/ComponentToPrint/ComponentToPrint.test.js +++ b/src/components/ComponentToPrint/ComponentToPrint.test.js @@ -30,6 +30,9 @@ jest.mock('../../util', () => ({ buildTemplate: jest.fn(Template => (data) => (Template ?