Ce produit n'est pas pris en charge par le site Datadog que vous avez sélectionné. ().
Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
The script argument to sh -c is run by a new shell. If that argument is double-quoted and contains
parameter expansion ($var, ${var}), the outer shell substitutes values into the string before the
inner shell parses it, which can turn filenames or other input into command injection (CWE-78).
Prefer passing data as operands after the script (e.g. sh -c 'cmd "$1"' _ "$path")
or a single-quoted script so the outer shell does not expand into the -c text.
Non-Compliant Code Examples
#!/bin/bash
sh -c "rm $file"/bin/sh -c "touch ${path}"sh -c "install $pkg in /opt"bash -c "run $cmd"/usr/bin/zsh -c "cp ${src} dest"