Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Nov 11, 2024
1 parent 21942ea commit 4d85154
Show file tree
Hide file tree
Showing 8 changed files with 499 additions and 495 deletions.
7 changes: 5 additions & 2 deletions core/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ const ALLOWED_TAGS = [

let DOMPurify: ReturnType<typeof createDOMPurify> | undefined

export function sanitizeDOM(html: string): HTMLElement {
export function sanitizeDOM(html: string): Node {
if (!DOMPurify) DOMPurify = createDOMPurify(window)
return DOMPurify.sanitize(html, { ALLOWED_TAGS, RETURN_DOM: true })
return DOMPurify.sanitize(html, {
ALLOWED_TAGS,
RETURN_DOM: true
})
}

export function parseRichTranslation(text: string): string {
Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@nanostores/i18n": "0.12.2",
"@nanostores/persistent": "0.10.2",
"@slowreader/api": "workspace:*",
"dompurify": "3.1.7",
"dompurify": "3.2.0",
"just-debounce-it": "3.2.0",
"nanoid": "5.0.8",
"nanostores": "0.11.3"
Expand Down
12 changes: 7 additions & 5 deletions core/test/html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import { parseLink, parseRichTranslation, sanitizeDOM } from '../index.ts'

test('sanitizes HTML', () => {
equal(
sanitizeDOM(
'<script>alert("XSS")</script>' +
'<b>Safe</b>' +
'<form></form>' +
'<iframe//src=jAva&Tab;script:alert(3)>'
(
sanitizeDOM(
'<script>alert("XSS")</script>' +
'<b>Safe</b>' +
'<form></form>' +
'<iframe//src=jAva&Tab;script:alert(3)>'
) as HTMLElement
).innerHTML,
'<b>Safe</b>'
)
Expand Down
2 changes: 1 addition & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
},
"dependencies": {
"@crxjs/vite-plugin": "2.0.0-beta.23",
"vite": "^5.4.10"
"vite": "^5.4.11"
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@logux/eslint-config": "53.4.2",
"@types/chrome": "^0.0.280",
"@types/node": "22.8.7",
"@types/node": "22.9.0",
"@types/ws": "8.5.13",
"better-node-test": "0.7.1",
"eslint": "9.14.0",
Expand All @@ -43,7 +43,7 @@
"nano-staged": "0.8.0",
"postcss-html": "1.7.0",
"prettier": "3.3.3",
"prettier-plugin-svelte": "3.2.7",
"prettier-plugin-svelte": "3.2.8",
"remark-cli": "^12.0.1",
"remark-lint-check-toc": "^1.0.0",
"remark-lint-code-block-split-list": "^1.0.0",
Expand All @@ -57,8 +57,8 @@
"remark-lint-smarty-pants-typography": "^1.1.0",
"remark-validate-links": "^13.0.2",
"stylelint": "16.10.0",
"svelte": "5.1.9",
"svelte-check": "4.0.5",
"svelte": "5.1.15",
"svelte-check": "4.0.7",
"svgo": "3.3.2",
"typescript": "5.6.3"
},
Expand Down
Loading

0 comments on commit 4d85154

Please sign in to comment.