Issue: Trusted strings, shell escaping and backwards compatibility.
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reviewing the discussion in #283 and the common execute() path used by test(), capture(), and execute(), then trace environment handling through with() and default_env. Determine the intended taint and escaping behavior for these entry points, including the proposed backwards-compatible warnings. Done means the behavior is agreed and its compatibility and failure cases are specified.
Written by the indexing model from the issue text.
Description
@ncreuschling @mattbrictson /cc
Continuing from the discussion in #283 I'd like to raise the general issue of shell escaping (shellwords) and what we mean/expect about "escaping strings" and so forth, whilst closing #283 it came to my mind that Rails using Object#taint, Object#tainted? and family works mostly pretty well.
I want to unify behavior.
I would propose the following:
- Identify where we want to escape things, if at all:
- Arguments to
test(),capture(),execute()etc (via the commonexecute()function) - Environment variables, and values when used with
with(){} - Environment variables when used with
default_env
- Arguments to
- Find out if strings are
taintedor not by default in the Capistrano context. - Find a backwards compatible way to:
- Issue a release with warnings for "tainted" strings in the places we care about, warning that behavior will change
- See if it makes sense to compare untrusted (the trust vernacular is deprecated) against their shellescaped counterparts, and exit with an error in that case.
I'm afraid that strings coming from the same file that is running will be trusted by default, so the whole plan falls apart, I'd have to look more closely at the API to see if the default taint value for a string is tainted, untainted, or (ideally) none.
Ideally, this would mean, I could do something like this:
SSHKit.config.default_env = {
"$MY_LITTLE_PONY".untaint => "i should however be escaped"
}
This would lead to us calling a literal export $MY_LITTLE_PONY=i should however be escaped, for better or worse.
- Dominant language
- Ruby
- Stars
- 1.2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from capistrano/sshkit
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
capistrano/sshkit#563 · 6 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
capistrano/sshkit#562 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
capistrano/sshkit#554 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
capistrano/sshkit#543 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
capistrano/sshkit#518 · 1 comment ·
All issues in capistrano/sshkit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
riscv/riscv-unified-db#2626 ·
-
Component: GLib
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
ds-drift
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
we-promise/sure#3693 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
simp/pupmod-simp-simp#395 ·