Oh-My-Zsh Install Script — Security Audit Report¶
Quest: Terminal Enchantment — Challenge 1 Purpose: Reference audit findings for the official Oh-My-Zsh install.sh
Audit Summary¶
| Property | Finding |
|---|---|
| Script Size | ~578 lines, ~19KB |
| Error Handling | set -e enabled (exits on any error) |
| Backup Mechanism | Existing .zshrc backed up to .zshrc.pre-oh-my-zsh |
| User Confirmation | Prompts before overwriting (configurable via KEEP_ZSHRC and OVERWRITE_CONFIRMATION env vars) |
| External Downloads | Clones from https://github.com/${REPO}.git (defaults to ohmyzsh/ohmyzsh) |
| Sudo Usage | Only checks if sudo is available for chsh (changing default shell) — does NOT run arbitrary sudo |
| Destructive Commands | No rm -rf of user data detected |
| Verdict | ✅ SAFE — Well-documented, backs up config, uses defensive error handling |
What to Check When Auditing¶
When performing your own audit on the install script, verify these items:
1. Error Handling¶
2. Backup Behavior¶
3. Remote URLs¶
grep -n 'http\|https\|curl\|wget\|git clone' install.sh
# Expected: Only github.com URLs for the ohmyzsh repository
4. Dangerous Commands¶
grep -n 'rm -rf\|sudo\|chmod 777\|eval.*\$' install.sh
# Expected: sudo only for chsh, no rm -rf on user directories
5. Environment Variable Overrides¶
grep -n 'REPO\|REMOTE\|BRANCH\|KEEP_ZSHRC' install.sh
# Expected: Configurable but with safe defaults
Expected Audit Verdict¶
A passing audit should confirm:
- [x] Script uses set -e for error safety
- [x] Existing config is backed up before overwriting
- [x] Only downloads from official GitHub repositories
- [x] No destructive operations on user data
- [x] Sudo is used minimally and only for shell changes
- [x] User can control behavior via environment variables