| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 52edebc commit c7378c4
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -141,6 +141,10 @@ added: v0.1.90 | |||
| 141 | 141 | Spawns a shell then executes the `command` within that shell, buffering any | |
| 142 | 142 | generated output. | |
| 143 | 143 | ||
| 144 | + **Note: Never pass unsanitised user input to this function. Any input | ||
| 145 | + containing shell metacharacters may be used to trigger arbitrary command | ||
| 146 | + execution.** | ||
| 147 | + | ||
| 144 | 148 | ```js | |
| 145 | 149 | const exec = require('child_process').exec; | |
| 146 | 150 | exec('cat *.js bad_file | wc -l', (error, stdout, stderr) => { | |
@@ -314,6 +318,10 @@ The `child_process.spawn()` method spawns a new process using the given | |||
| 314 | 318 | `command`, with command line arguments in `args`. If omitted, `args` defaults | |
| 315 | 319 | to an empty array. | |
| 316 | 320 | ||
| 321 | + **Note: If the `shell` option is enabled, do not pass unsanitised user input to | ||
| 322 | + this function. Any input containing shell metacharacters may be used to | ||
| 323 | + trigger arbitrary command execution.** | ||
| 324 | + | ||
| 317 | 325 | A third argument may be used to specify additional options, with these defaults: | |
| 318 | 326 | ||
| 319 | 327 | ```js | |
@@ -620,6 +628,10 @@ If the process times out, or has a non-zero exit code, this method ***will*** | |||
| 620 | 628 | throw. The [`Error`][] object will contain the entire result from | |
| 621 | 629 | [`child_process.spawnSync()`][] | |
| 622 | 630 | ||
| 631 | + **Note: Never pass unsanitised user input to this function. Any input | ||
| 632 | + containing shell metacharacters may be used to trigger arbitrary command | ||
| 633 | + execution.** | ||
| 634 | + | ||
| 623 | 635 | ### child_process.spawnSync(command[, args][, options]) | |
| 624 | 636 | <!-- YAML | |
| 625 | 637 | added: v0.11.12 | |
@@ -661,6 +673,10 @@ completely exited. Note that if the process intercepts and handles the | |||
| 661 | 673 | `SIGTERM` signal and doesn't exit, the parent process will wait until the child | |
| 662 | 674 | process has exited. | |
| 663 | 675 | ||
| 676 | + **Note: If the `shell` option is enabled, do not pass unsanitised user input to | ||
| 677 | + this function. Any input containing shell metacharacters may be used to | ||
| 678 | + trigger arbitrary command execution.** | ||
| 679 | + | ||
| 664 | 680 | ## Class: ChildProcess | |
| 665 | 681 | <!-- YAML | |
| 666 | 682 | added: v2.2.0 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments