feat(custom-widgets): harden AI authoring (credential redaction, JSX policy) (#6700)

This commit is contained in:
Thomas authored and GitHub committed 2026-08-25 17:11:24 +02:00
1 parent 9303dbd284
commit 3ee9b4f0c4
14 files changed
+333 -92

No files matched your search

@@ -10,6 +10,7 @@ import {
getCustomWidgetSkill,
getCustomWidgetSkillContent,
} from "../core/authoring-resources";
import { validateCustomJsxTemplate } from "../jsx/analyzer";
const skillSourceDirectory = path.resolve(import.meta.dirname, "../../../../.agents/skills/homarr-custom-widget");
@@ -55,6 +56,11 @@ describe("authoring resources", () => {
sources: { default: { baseUrl: "https://pokeapi.co" } },
},
});
const serviceDashboard = getCustomWidgetExample("service-dashboard");
if (!serviceDashboard) throw new Error("Service dashboard example is missing");
expect(validateCustomJsxTemplate(serviceDashboard.widget.template)).toEqual([]);
expect(serviceDashboard.widget.template.match(/<Paper/gu)).toHaveLength(1);
expect(serviceDashboard.widget.template).toContain('RefreshButton label="Refresh service health"');
expect(Buffer.byteLength(JSON.stringify(pokedex), "utf8")).toBeLessThan(16_000);
expect(catalog.sharedProps).toMatchObject({
count: expect.any(Number),