fix: reject control characters in manifest URLs
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
loadToolboxContext,
|
||||
parseToolboxApp,
|
||||
parseToolboxCatalog,
|
||||
resolveWebUrl,
|
||||
type ToolboxAppManifest,
|
||||
} from "../src/index.js";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
@@ -179,6 +180,21 @@ describe("same-origin discovery", () => {
|
||||
});
|
||||
|
||||
describe("loading and links", () => {
|
||||
it.each([
|
||||
["TAB", "\t"],
|
||||
["LF", "\n"],
|
||||
["CR", "\r"],
|
||||
["C0", "\u0001"],
|
||||
["DEL", "\u007f"],
|
||||
])("rejects %s in URL helper string inputs", (_name, control) => {
|
||||
expect(() =>
|
||||
resolveWebUrl(`./before${control}after`, "https://tools.example.test/"),
|
||||
).toThrow(/control characters/u);
|
||||
expect(() =>
|
||||
resolveWebUrl("./tool", `https://tools.example.test/${control}`),
|
||||
).toThrow(/control characters/u);
|
||||
});
|
||||
|
||||
it("loads a catalog, resolves manifests and URLs, and supports external apps", async () => {
|
||||
const fetch = vi.fn(
|
||||
async (input: string | URL | Request, init?: RequestInit) => {
|
||||
|
||||
Reference in New Issue
Block a user