Reject model IDs unsafe for headers and clarify supported capabilities
This commit is contained in:
parent
ec9a2b173a
commit
7754377b3e
1 changed files with 22 additions and 5 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue