char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Aleksander Grygierui: Constants refactor (#26908)e21152dc9

char/aliceai-t5-moe
901 B20 linesraw
1/**
2 * Key-value pair form constraints and sanitization patterns.
3 *
4 * Both regexes target characters dangerous in HTTP-header / env-var contexts:
5 *   \x00        – null byte (injection)
6 *   \x0A (\n)   – LF  (HTTP header injection / response splitting)
7 *   \x0D (\r)   – CR  (HTTP header injection / response splitting)
8 *   \x01–\x08, \x0B–\x0C, \x0E–\x1F, \x7F – other C0/DEL control chars
9 *
10 * KEY_UNSAFE_RE additionally strips TAB (\x09); values keep TAB because it is
11 * a valid header-value continuation character per RFC 7230.
12 */
13
14export const KEY_VALUE_PAIR_KEY_MAX_LENGTH = 256;
15export const KEY_VALUE_PAIR_VALUE_MAX_LENGTH = 8192;
16
17// eslint-disable-next-line no-control-regex
18export const KEY_VALUE_PAIR_UNSAFE_KEY_RE = /[\x00-\x1F\x7F]/g;
19// eslint-disable-next-line no-control-regex
20export const KEY_VALUE_PAIR_UNSAFE_VALUE_RE = /[\x00-\x08\x0A-\x0D\x0E-\x1F\x7F]/g;