Language: TypeScript
Label: safe
CWE: CWE-150 \u2014 Improper Neutralization of Escape, Meta, or Control Sequences
The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.

Code:
export function escape(arg, options = {}) {
  const helpers = getPlatformHelpers();
  const { flagProtection, interpolation, shellName } = parseOptions(
    { env: process.env, options },
    helpers,
  );
  const argAsString = checkedToString(arg);
  const escape = helpers.getEscapeFunction(shellName, { interpolation });
  const escapedArg = escape(argAsString);
  if (flagProtection) {
    const flagProtect = helpers.getFlagProtectionFunction(shellName);
    return flagProtect(escapedArg);
  } else {
    return escapedArg;
  }
}