Tests first: a target must hold a letter or a number; marks, private-use, unassigned, surrogate and null-symbol targets are blank

Fail on bda14e3: the blocklist accepts U+0300, U+E000, U+0378, a lone surrogate, U+16FE4, U+1D159 and U+F0000 (201 where 400 is wanted; custody_only where refused).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Heimdall 2026-11-09 12:13:31 +00:00
commit 6c3139ef60

View file

@ -1444,7 +1444,11 @@ describe("Heimdall service", () => {
const BLANK_TARGETS = [
" ", "\t", "\n ", "\u200B", "\u00A0\uFEFF",
"\u2800", "\u3164", "\u115F", "\u1160", "\uFFA0", "\u034F", "\u0000", "\u0007", " \u2800\u3164 ",
// Marks, private-use, unassigned and lone-surrogate code points, and the symbols that read as nothing: none is a letter or a number.
"\u0300", "\uE000", "\u0378", "\uD800", "\u{16FE4}", "\u{1D159}", "\u{F0000}", "\u0300\uE000 ",
];
// A target is usable when it holds a letter or a number that is not an invisible filler.
const NAMING_TARGETS = ["creator-1", " creator-1 ", "Framgång", "42", "\u2800a\u3164", "\u3164\u0300x"];
describe("a connect start that names a connection target is the app backend's", () => {
// The target is app-backend authority: the StreamPixels backend proves the creator-manage session and states the
@ -1505,7 +1509,9 @@ describe("Heimdall service", () => {
expect(refused.body).not.toContain("authorizationUrl");
}
}
expect((await startFor(app, provider, { kind: "creator", targetId: " creator-1 " }, own)).statusCode).toBe(201);
for (const targetId of NAMING_TARGETS) {
expect((await startFor(app, provider, { kind: "creator", targetId }, own)).statusCode, JSON.stringify(targetId)).toBe(201);
}
});
it.each(managed)("%s: a blank target without the app's secret gets 401, not the 400 that would tell a stranger what the gate checks", async (provider) => {
@ -1527,7 +1533,9 @@ describe("Heimdall service", () => {
}
// A visible character among the blanks names a target.
expect(callbackMint(streampixels, "joystick", "connect", { kind: "creator", targetId: "\u2800a\u3164" })).toBe("custody_only");
expect(callbackMint(streampixels, "joystick", "connect", { kind: "creator", targetId: "creator-1" })).toBe("custody_only");
for (const targetId of NAMING_TARGETS) {
expect(callbackMint(streampixels, "joystick", "connect", { kind: "creator", targetId }), JSON.stringify(targetId)).toBe("custody_only");
}
});
});