X Tutup
Skip to content

gh cs cp: disable remote shell expansion unless -e flag#4564

Merged
adonovan merged 1 commit intotrunkfrom
e-flag
Oct 19, 2021
Merged

gh cs cp: disable remote shell expansion unless -e flag#4564
adonovan merged 1 commit intotrunkfrom
e-flag

Conversation

@adonovan
Copy link
Copy Markdown
Contributor

@adonovan adonovan commented Oct 19, 2021

#4486 added support for 'gh cs cp', a command to copy files between the local and remote file systems. It is implemented as a wrapper around scp. We recently learned that scp arguments are subject to all forms of shell expansion on the remote machine, which is useful but a potential security risk.

This PR disables remote shell expansion by default. The expansion behavior must be explicitly enabled by passing the -e flag.

Example:

$ gh cs cp -c ... 'remote:~/.bash*' dotfiles/
scp: ~/.bash*: No such file or directory
shell closed: exit status 1
$ gh cs cp -c ... -e 'remote:~/.bash*' dotfiles/
.bash_history                                                                              100% 5833   190.0KB/s   00:00    
.bashrc                                                                                    100% 1112    35.8KB/s   00:00    

$ gh cs cp -c ... -e 'remote:/workspaces/$RepositoryName/README.md' README
README.md                                                                                  100%  951    18.9KB/s   00:00    

@adonovan adonovan enabled auto-merge October 19, 2021 14:27
@adonovan adonovan merged commit fc1de3a into trunk Oct 19, 2021
@adonovan adonovan deleted the e-flag branch October 19, 2021 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup