/careful: heredoc bodies are scanned as shell commands
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 57/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- bash, shell, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 143k
- Forks
- 21k
- Merge medio
- 7 h 19 min
- PR fusionados (30 d)
- 781
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de garrytan/gstack
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
setup: --refresh-registered reinstalls Codex globally from the checkout's own .agents renderAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
enhancement S3
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
garrytan/gstack#4812 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug S3
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
garrytan/gstack#4771 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de garrytan/gstack
Issues similares
-
Add Alice&BotAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
slavakurilyak/awesome-ai-agents#1048 ·
-
bot:ai-assisted component:faucet github_actions security status:untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
midnightntwrk/midnight-faucet-api#215 ·
Los mantenedores suelen responder en 1 día
-
[功能] 手机端命令执行显示 AI 动作描述Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NanmiCoder/cc-haha#2034 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
MoonshotAI/kimi-code#5539 ·
Los mantenedores suelen responder en 1 día
-
mobile prio:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
digitalfabrik/entitlementcard#3324 ·
Los mantenedores suelen responder en 2 días