Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Issue: Trusted strings, shell escaping and backwards compatibility.

Aperta
#333 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
ruby, shell
Ambito
devops, security

Direzione di ricerca

Inizia esaminando la discussione in #283 e il percorso comune di execute() utilizzato da test(), capture() ed execute(), quindi traccia la gestione dell’ambiente attraverso with() e default_env. Determina il comportamento previsto per taint ed escaping di questi punti di ingresso, inclusi gli avvisi proposti compatibili con le versioni precedenti. Il lavoro è completato quando il comportamento è concordato e sono specificati la relativa compatibilità e i casi di errore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

discuss!

@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 common execute() function)
    • Environment variables, and values when used with with(){}
    • Environment variables when used with default_env
  • Find out if strings are tainted or 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.

Lingua principale
Ruby
Stelle
1.2k
Fork
257
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di capistrano/sshkit

Tutte le issue di capistrano/sshkit

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.