mirror of
https://github.com/mgeeky/decode-spam-headers.git
synced 2026-02-22 13:33:30 +01:00
MAESTRO: enforce header input validation
This commit is contained in:
13
frontend/src/lib/header-validation.ts
Normal file
13
frontend/src/lib/header-validation.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export const MAX_HEADER_INPUT_BYTES = 1024 * 1024;
|
||||
|
||||
export const validateHeaderInput = (value: string): string | null => {
|
||||
if (value.length > MAX_HEADER_INPUT_BYTES) {
|
||||
return "Header input exceeds the 1 MB limit.";
|
||||
}
|
||||
|
||||
if (value.trim().length === 0) {
|
||||
return "Header input cannot be empty.";
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
Reference in New Issue
Block a user