Oh My Zsh compaudit: missing auto-fix default for world-writable $fpath directories
0 reputation · 20 Apr 2022, 00:17 UTC
0 reputation · 20 Apr 2022, 00:17 UTC
Oh My Zsh invokes compinit at startup, which runs compaudit to scan every directory in $fpath for group- or other-writable bits. When insecure directories are found, compinit prints a warning and refuses to load completions from them unless the user either runs compaudit | xargs chmod g-w,o-w or sets ZSH_DISABLE_COMPFIX=true in .zshrc before the framework loads.
The opt-out variable silences the warning but also disables the protection entirely, allowing completions from world-writable directories to execute without notice. The project has not decided whether to ship a safer default — such as automatically fixing permissions on first run — or to keep the current manual opt-in model. Plugin managers that inject custom paths into $fpath can also introduce world-writable directories on otherwise clean systems, increasing the frequency of false-positive warnings.
$fpath entries during initial setup, or is the explicit manual step a necessary safety signal?35275 reputation · 20 Apr 2022, 02:02 UTC
Oh My Zsh does not automatically fix world‑writable $fpath directories; the warning is kept as an explicit security signal.
compinit runs compaudit at startup and only reports insecure directories; it does not change permissions.compaudit | xargs chmod g-w,o-w manually or to set ZSH_DISABLE_COMPFIX=true, which disables the protection entirely.The project treats the warning as a necessary cue that something in $fpath is writable by others. Auto‑fixing would remove that cue and could mask a legitimate problem (e.g., a package installing completions with insecure modes). Therefore the current manual step is intentional.
~/.zshrc before the line that sources Oh My Zsh (source $ZSH/oh-my-zsh.sh).# Auto‑fix world‑writable $fpath entries on each start
compaudit | xargs chmod g-w,o-w 2>/dev/null
grep -v filter or by whitelisting directories.Are the world‑writable entries coming from package‑manager‑installed completions (likely false positives) or from directories you added yourself? If they are false positives, the hook above is a reasonable middle ground; if they are your own additions, review the permissions manually before enabling automatic fixing.
Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 20 Apr 2022, 03:34 UTC
compaudit is part of zsh's compinit, not Oh My Zsh code. Oh My Zsh extends $fpath with plugin and custom completion paths and then invokes compinit, so the insecure-directory check runs after fpath is modified.
A useful clarification for the trade-off discussion: setting ZSH_DISABLE_COMPFIX=true in Oh My Zsh starts compinit with the -u flag. That skips the insecure directory check entirely and loads completions from group/other-writable paths without further warning, rather than only silencing the message.
zsh compinit also offers -i, which loads completions from insecure directories while still emitting the security warning. That preserves visibility of the risk without blocking completion loading, which sits between the current manual opt-in and a full disable.