Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I built the tool my agent-guard README said didn't exist yet

Description and use

bash‑write‑targets statically lists potential file write targets in Bash commands, enhancing agent‑guard’s safety audit.

Problem

Agent-guard’s Bash PreToolUse hook lacked a robust static parser to list potential file write targets in a command string, limiting its safety audit capabilities.

Outcome

The tool accurately captures write targets for redirection, heredocs, command substitution, tee, file operations, sed, dd, truncate, touch, zip, and various command flags, while conservatively skipping ambiguous cases.

Workflow

  • 1. Install bash-write-targets via pip.
  • 2. Run targets '<bash command>' to receive a list of write targets.
  • 3. Optionally use --json for machine‑readable output.

Evidence

Bash write-target extraction is static and approximate.

Source

What it catches: > >> &> 2> heredocs (bodies are stripped so <<EOF content isn't mistaken for targets), $(...) and backticks (scanned recursively), tee (all operands, -a aware), cp/mv/install destinations, sed -i (script vs. file disambiguation), dd of=, truncate, touch, zip archives, and -o/--output flags for curl, wget, gcc, sort, pandoc, psql, tar -f.

Source

Pure static parsing over the command string. Nothing is executed, no subshell is spawned, no file is touched — auditing a destructive command cannot itself be destructive.

Source

  • Record date: 2026-10-21T08:56:05.019Z