security: tighten config-dir perms and validate plugin scope argv
Merged
JE
4mo ago+4628+4628+0123456789012345678901234567890123456789-182-182-012345678901234567890123456789
Tighten config-dir perms and validate plugin --scope argv
(Threats: T3 other local users on a shared machine; T6 untrusted data into exec args.)
- 0700 global config dir ā the skill-refresh and update-notice bootstrap created
~/.config/basecamp/at0755, and it runs before the auth store, leaving a dir that can holdcredentials.jsonworld-listable. Changed both bootstrapMkdirAlls to0o700and added a one-timeos.Chmod(GlobalConfigDir(), 0o700)inroot.goto tighten dirs created by older versions. (Intentionally-world-readable~/.agents/~/.claude/skillsdirs left at0755.) - Plugin scope whitelist ā the
scoperead frominstalled_plugins.jsonwas appended after--scopeinclaude plugin uninstallunvalidated; a--leading value injects a flag. Now whitelisted to{user, project, local}.
Tests
TestValidPluginScope.
Part 5/6 of the stacked security series. Base: security/04-config-trust-gating.
š Stack (merge bottom-up)
- #478 ā reject foreign-host URLs in
api(basemain) - #479 ā strip ANSI/OSC escapes from output
- #480 ā harden OAuth discovery / token endpoints
- #481 ā close config trust-boundary gaps + completion gate
- #482 ā tighten config-dir perms + plugin scope argv
- #483 ā bump toolchain/x-net + CI gates
Each is independent except #482 depends on #481 (shared root.go). #478 can land first/alone.