Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency dompurify to v3.2.0 j:kit-282 #4724

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/atomic/cypress/e2e/icon-assertions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {sanitize} from 'dompurify';
import DOMPurify from 'dompurify';
import {getSvg} from './icon-utils';

function getSortedClone(element: Element) {
Expand All @@ -22,7 +22,7 @@ export function assertRendersIcon(
selector().should(([actualSvgElement]) =>
expect(getSortedClone(actualSvgElement).outerHTML).to.eq(
getSortedClone(
sanitize(expectedSvg, {
DOMPurify.sanitize(expectedSvg, {
USE_PROFILES: {svg: true, svgFilters: true},
RETURN_DOM_FRAGMENT: true,
}).querySelector('svg')!
Expand Down
3 changes: 1 addition & 2 deletions packages/atomic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@salesforce-ux/design-system": "^2.16.1",
"@stencil/store": "2.0.16",
"dayjs": "1.11.12",
"dompurify": "3.1.6",
"dompurify": "3.2.0",
"escape-html": "1.0.3",
"focus-visible": "5.2.0",
"i18next": "23.12.2",
Expand Down Expand Up @@ -115,7 +115,6 @@
"@swc/core": "~1.7.0",
"@swc/helpers": "~0.5.2",
"@types/core-js": "2.5.8",
"@types/dompurify": "3.0.5",
"@types/escape-html": "1.0.4",
"@types/jest": "29.5.12",
"@types/lodash": "4.17.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
State,
Watch,
} from '@stencil/core';
import {sanitize} from 'dompurify';
import DOMPurify from 'dompurify';
import {
InitializableComponent,
InitializeBindings,
Expand Down Expand Up @@ -102,7 +102,7 @@ export class AtomicIcon implements InitializableComponent<AnyBindings> {
this.validateSVG(svg);
}
const sanitizedSvg = svg
? sanitize(svg, {
? DOMPurify.sanitize(svg, {
USE_PROFILES: {svg: true, svgFilters: true},
})
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Host,
Element,
} from '@stencil/core';
import {sanitize} from 'dompurify';
import DOMPurify from 'dompurify';
import {sanitizeStyle} from '../../../../utils/utils';
import {bindAnalyticsToLink} from '../../item-link/item-link';

Expand Down Expand Up @@ -125,7 +125,7 @@ export class AtomicSmartSnippetAnswer {
>
{/* deepcode ignore ReactSetInnerHtml: Sanitized by back-end + dompurify */}
<div
innerHTML={sanitize(this.htmlContent, {
innerHTML={DOMPurify.sanitize(this.htmlContent, {
USE_PROFILES: {html: true},
})}
ref={(element) => element && this.bindAnalyticsToLinks(element)}
Expand Down
4 changes: 2 additions & 2 deletions packages/atomic/src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {getAssetPath} from '@stencil/core';
import {NODE_TYPES} from '@stencil/core/mock-doc';
import {sanitize} from 'dompurify';
import DOMPurify from 'dompurify';

/**
* Returns a function that can be executed only once
Expand Down Expand Up @@ -149,7 +149,7 @@ export const sortByDocumentPosition = (a: Node, b: Node): 1 | -1 =>
a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;

export function sanitizeStyle(style: string) {
const purifiedOuterHTML = sanitize(`<style>${style}</style>`, {
const purifiedOuterHTML = DOMPurify.sanitize(`<style>${style}</style>`, {
ALLOWED_TAGS: ['style'],
ALLOWED_ATTR: [],
FORCE_BODY: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/quantic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"dependencies": {
"@coveo/bueno": "1.0.6",
"@coveo/headless": "3.10.0",
"dompurify": "3.1.6",
"dompurify": "3.2.0",
"marked": "12.0.2",
"fs-extra": "11.2.0"
},
Expand Down
Loading