2
0
Fork 0
mirror of https://github.com/nushell/nushell synced 2025-02-24 11:27:14 +00:00
nushell/crates/nu-command
Braulio Valdivielso Martínez 1794ad51bd
Sanitize arguments to external commands a bit better ()
* fix 

We are passing commands into a shell underneath but we were not
escaping arguments correctly. This new version of the code also takes
into consideration the ";" and "&" characters, which have special
meaning in shells.

We would probably benefit from a more robust way to join arguments to
shell programs. Python's stdlib has shlex.join, and perhaps we can
take that implementation as a reference.

* clean up escaping of posix shell args

I believe the right place to do escaping of arguments was in the
spawn_sh_command function. Note that this change prevents things like:

^echo "$(ls)"

from executing the ls command. Instead, this will just print

$(ls)

The regex has been taken from the python stdlib implementation of shlex.quote

* fix non-literal parameters and single quotes

* address clippy's comments

* fixup! address clippy's comments

* test that subshell commands are sanitized properly
2021-11-29 09:46:42 -06:00
..
assets nu-cli refactor moving commands into their own crate nu-command () 2021-01-12 17:59:53 +13:00
src Sanitize arguments to external commands a bit better () 2021-11-29 09:46:42 -06:00
tests save --append: create file if it doesn't exist () 2021-11-26 12:27:41 -06:00
build.rs nu-cli refactor moving commands into their own crate nu-command () 2021-01-12 17:59:53 +13:00
Cargo.toml upgrading dependencies () 2021-11-20 07:11:11 -06:00
README.md Begin directory contrib docs and split commands () 2021-06-19 12:06:44 +12:00

nu-command

The Nu command crate contains the full set of internal commands, that is, the commands that can be form the set of built-in commands in a Nushell engine.

The default set of commands that Nushell ships with can be found in the default context.

The commands themselves live in the commands module.