fix: harden automatic mobile boards

This commit is contained in:
ajnart committed 2026-08-13 19:55:17 +02:00
1 parent 5454bcc8ac
commit 967ed8dd73
25 files changed
+490 -92

No files matched your search

+3 -1
View File
@@ -15,9 +15,10 @@
".": "./index.ts",
"./_inputs/json-path-tree-picker": "./src/_inputs/json-path-tree-picker.tsx",
"./custom-api/component": "./src/custom-api/component.tsx",
"./custom-api/custom-jsx-display": "./src/custom-api/custom-jsx-display.tsx",
"./custom-api/extract-display-data": "./src/custom-api/extract-display-data.ts",
"./catalog": "./src/catalog.ts",
"./definition": "./src/definition.ts",
"./custom-api/custom-jsx-display": "./src/custom-api/custom-jsx-display.tsx",
"./errors": "./src/errors/component.tsx",
"./manifest": "./src/manifest.ts",
"./options": "./src/options.ts",
@@ -80,6 +81,7 @@
"@tiptap/extension-underline": "catalog:",
"@tiptap/react": "catalog:",
"@tiptap/starter-kit": "catalog:",
"@trpc/react-query": "catalog:",
"acorn": "catalog:",
"acorn-jsx": "catalog:",
"clsx": "catalog:",
+3 -2
View File
@@ -43,11 +43,13 @@ export function WidgetDataState({ children, hasWarning }: WidgetDataStateProps)
return (
<Box pos="relative" h="100%" w="100%">
{children}
{hasWarning && (
<Tooltip label={label} position="left" withArrow>
<Tooltip label={label} position="left" withArrow events={{ hover: true, focus: true, touch: true }}>
<Center
component="output"
aria-label={label}
tabIndex={0}
pos="absolute"
bottom={4}
w={28}
@@ -67,7 +69,6 @@ export function WidgetDataState({ children, hasWarning }: WidgetDataStateProps)
</Center>
</Tooltip>
)}
{children}
</Box>
);
}
@@ -0,0 +1,12 @@
import { describe, expect, test } from "vitest";
import { sanitizeFeedDescription } from "./sanitize-description";
describe("sanitizeFeedDescription", () => {
test("keeps basic formatting while removing executable markup", () => {
const description =
'<p onclick="alert(1)" aria-hidden="true" data-tracking="yes">News <strong>today</strong><script>alert(2)</script><img src="tracker"></p>';
expect(sanitizeFeedDescription(description)).toBe("<p>News <strong>today</strong></p>");
});
});
@@ -0,0 +1,11 @@
import { sanitize } from "isomorphic-dompurify";
const allowedDescriptionTags = ["b", "br", "em", "i", "li", "ol", "p", "s", "strong", "u", "ul"];
export const sanitizeFeedDescription = (description: string) =>
sanitize(description, {
ALLOW_ARIA_ATTR: false,
ALLOW_DATA_ATTR: false,
ALLOWED_ATTR: [],
ALLOWED_TAGS: allowedDescriptionTags,
});