Reject model IDs unsafe for headers and clarify supported capabilities
All checks were successful
CI / test (22) (push) Successful in 22s
CI / test (24) (push) Successful in 21s

This commit is contained in:
Benjamin Hackl 2026-11-03 21:46:37 +01:00
commit 7754377b3e

View file

@ -53,8 +53,11 @@ function isRecord(value: unknown): value is Record<string, unknown> {
}
function isValidId(id: unknown): id is string {
// IDs become an HTTP header value, so reject padding and control characters.
return typeof id === "string" && id.length > 0 && id.trim() === id && !/[\u0000-\u001f\u007f]/.test(id);
// Fetch header values must fit Latin-1; also reject padding and control characters.
return typeof id === "string"
&& id.length > 0
&& id.trim() === id
&& !/[\u0000-\u001f\u007f\u0100-\uffff]/.test(id);
}
export interface ParsedCatalog {