fix: harden assistant authoring and UI

This commit is contained in:
ajnart authored and Thomas Camlong committed 2026-08-09 18:09:11 +02:00
1 parent fa0e55cc93
commit edc7b4d55b
51 files changed
+4118 -916

No files matched your search

@@ -0,0 +1,17 @@
import { describe, expect, test } from "vitest";
import { getSafeAssistantHttpUrl } from "./assistant-url";
describe("getSafeAssistantHttpUrl", () => {
test("allows ordinary HTTP and HTTPS source URLs", () => {
expect(getSafeAssistantHttpUrl("https://example.com/source?q=homarr")).toBe("https://example.com/source?q=homarr");
expect(getSafeAssistantHttpUrl("http://example.com/source")).toBe("http://example.com/source");
});
test("rejects unsafe protocols, relative URLs, and embedded credentials", () => {
expect(getSafeAssistantHttpUrl("javascript:alert(1)")).toBeNull();
expect(getSafeAssistantHttpUrl("data:text/html;base64,PGgxPkJhZDwvaDE+")).toBeNull();
expect(getSafeAssistantHttpUrl("/manage/custom-widgets")).toBeNull();
expect(getSafeAssistantHttpUrl("https://user:secret@example.com/source")).toBeNull();
});
});