The thesis
Read it before you run it
A model’s output is executed directly against your machine with your privileges, usually pasted without being read. A person who can read a generated script first is the entire mitigation — and reading one requires knowing the expansion order.
The cleanup script
You asked for a script that clears a build directory. This is what came back.
#!/bin/sh # Clean the build output rm -rf "$BUILD_DIR/" echo "cleaned"
Before it runs — 1 of 2
BUILD_DIR is not set. What does line 4 remove?
Before it runs — 2 of 2
Which single line, added at the top, would have stopped it?
Answer first.
$
Files
| Mode | Links | Size | Name |
|---|---|---|---|
| drwxr-xr-x | 4 | project/ | |
| -rw------- | 1 | 66 | .env |
| -rw-r--r-- | 1 | 44 | README.md |
| drwxr-xr-x | 2 | build/ | |
| -rw-r--r-- | 1 | 6 | cache.tmp |
| -rw-r--r-- | 1 | 9 | output.bin |
| -rw-r--r-- | 1 | 100 | notes.txt |
| drwxr-xr-x | 2 | src/ | |
| -rw-r--r-- | 1 | 29 | lib.sh |
| -rwxr-xr-x | 1 | 41 | main.sh |