- Case ID
- #5361
- Severity
- CRIT
- Decision
- BLOCK
- Agent
- VS Code
- Category
- Shell Safety
Correction note (2026-10-13). The per-call timings and latency figures that appeared in this article had no benchmark behind them and were removed. Sample output in this article is illustrative, not a recorded run. The only published measurement is p50 0.39 ms and p99 1.91 ms (sigmashake-bench daemon-socket run, 2026-06-10, ssg 0.29.156, n=500). Sub-2 ms evaluation is a design target.
Describe the task
VS Code Copilot is cleaning up stale build artifacts. It constructs a path to remove, but due to a working-directory assumption, the resolved path points to the project root instead of the dist/ subdirectory:
rm -rf /home/user/project
SSG intercepts this before a single file is removed.
# illustrative sample output
[BLOCK] bash › rm -rf /home/user/project — rule: no-rm-rf-home
Give SSG context
SSG evaluates VS Code Copilot's shell commands via the SSG MCP Server integration.
Required context
rule no-rm-rf-home {
enabled true
priority 100
severity error
DENY execution
IF command STARTS_WITH "rm -rf"
AND command CONTAINS "/home/"
MESSAGE "Refusing to rm -rf a home directory path. Scope the delete to a specific subdirectory."
}
Optional context
Also block bare rm -rf /:
rule no-rm-rf-root {
enabled true
priority 100
severity error
DENY execution
IF command STARTS_WITH "rm -rf /"
MESSAGE "Deleting from root is blocked. Use a relative path within your project."
}
What SSG does
SSG catches the command at the tool-call layer before the shell ever sees it. No files are staged for deletion — the block fires before any syscall is made.
Ask the agent to scope the delete
rm -rf was blocked on a home directory path. Use a project-relative path:
rm -rf ./dist
rm -rf ./build
rm -rf ./.cache
Confirm the working directory with pwd before running any destructive commands.
Add an ALLOW rule for known safe patterns
If your CI workflow legitimately cleans a specific dist directory, allowlist it:
rule allow-rm-dist {
enabled true
priority 200
severity info
ALLOW execution
IF command MATCHES "^rm -rf \./dist$"
MESSAGE "Deleting the dist build directory is allowed."
}
How your rule handles path variations
The CONTAINS "/home/" check catches both /home/user/project and /home/runner/work/... (common in CI). For Windows-style paths, add a second rule matching CONTAINS "\\Users\\".
Check the rule against your build scripts
Some build tools (webpack, vite) emit rm -rf dist as part of their clean step. Verify these match your ALLOW rule before deploying to avoid blocking legitimate CI runs.