/careful: heredoc bodies are scanned as shell commands
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 57/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- bash, shell, typescript
Direzione di ricerca
Start by reading careful/bin/check-careful.sh and the change for #1060, which the issue identifies as handling two heredoc cases. Reproduce the quoted heredoc examples and inspect how the statement scan treats their bodies; also check _RX_TMP for the Windows temp-folder behavior. Done means quoted heredoc text no longer triggers destructive-command prompts, executable substitutions remain scanned, and recursive deletes under the resolved %TEMP% path are treated as scratch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Since 1.103 made the destructive-command check a default hook, I get approval prompts in auto mode for commands that don't delete anything. Almost all of them have the same cause: the check reads the body of a heredoc as if it were shell.
#1060 fixed this for git commit -m "..." and for -m "$(cat <<'EOF' ... EOF)". Any other heredoc still goes through the statement scan, which splits the body at newlines and backticks and checks each line as a command.
Repro
1.103.1.0 on Windows 11 with Git Bash. I sent each of these as tool_input.command to careful/bin/check-careful.sh:
python - <<'EOF'
t = "the script runs rm -rf on the staging lib folder"
print(t)
EOF
git commit -F - <<'EOF'
staging: rm -rf the lib folder before copying
EOF
Both come back with:
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"ask","permissionDecisionReason":"[careful] Destructive: recursive delete (rm -r). This permanently removes files."}}
The same message through git commit -m "$(cat <<'EOF' ... EOF)" returns {}, and so does the Python heredoc once the string no longer says rm.
Agents write heredocs like these all day, for small Python edits and for commit messages, and the text tends to describe the change. The one that made me look was a script rewriting a changelog line about a build step that clears a folder.
What I'd expect
With a quoted delimiter (<<'EOF', <<"EOF", <<\EOF) the body is literal, so it could be skipped the same way the commit message is. With an unquoted delimiter, $(...) and backticks in the body still run, so those parts would still need the scan.
Windows temp folders
A smaller thing. A recursive delete only counts as scratch under /tmp and /var/tmp (_RX_TMP). Git Bash maps /tmp to %TEMP%, but the same folder written as C:/Users/<user>/AppData/Local/Temp/<dir> still asks, and that's the spelling my agent's scratch folder has. Treating the resolved %TEMP% path like /tmp would cover it.
For now I've turned the guard off with gstack-config set destructive_guard off. That works, but I'd rather have it on.
- Lingua principale
- TypeScript
- Stelle
- 143k
- Fork
- 21k
- Merge medio
- 7h 19m
- PR unite (30g)
- 781
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di garrytan/gstack
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement S3
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
garrytan/gstack#4812 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug S3
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
garrytan/gstack#4771 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di garrytan/gstack
Issue simili
-
Add Alice&BotAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
slavakurilyak/awesome-ai-agents#1048 ·
-
bot:ai-assisted component:faucet github_actions security status:untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
midnightntwrk/midnight-faucet-api#215 ·
I maintainer di solito rispondono entro 1 giorno
-
[功能] 手机端命令执行显示 AI 动作描述Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NanmiCoder/cc-haha#2034 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
MoonshotAI/kimi-code#5539 ·
I maintainer di solito rispondono entro 1 giorno
-
mobile prio:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
digitalfabrik/entitlementcard#3324 ·
I maintainer di solito rispondono entro 2 giorni