Skip to content

assertSafeFtpArgument

function assertSafeFtpArgument(value: string, label?: string): string;

Defined in: src/utils/path.ts:26

Validates that an FTP command argument cannot inject additional command lines.

NUL bytes are rejected alongside CR/LF: C-string-based servers and filesystem APIs truncate at the first NUL, which lets a crafted path smuggle a different effective target past validation.

ParameterTypeDefault valueDescription
valuestringundefinedArgument value to validate.
labelstring"path"Human-readable argument label used in error messages.

string

The original value when it is safe.

ConfigurationError When the value contains CR, LF, or NUL characters.