T09 · Insecure Skill Coding Practices
- Location
scripts/codebuddy-cli.js:271- Finding
Repository-controlled project hooks can execute during unattended permission-bypassed runs
- Content
View full analysis
Vulnerability Details
File Location:
scripts/codebuddy-cli.js:271-283; supporting workflow instructions inSKILL.md:430-445andSKILL.md:586-601
Vulnerability Type: Unsafe loading of repository-controlled executable configuration
Risk Level: HighVulnerable Code
javascript const args = ['--setting-sources', 'project', ...passthrough]; const bootstrap = path.join(__dirname, 'skills-bootstrap.md'); if (fs.existsSync(bootstrap)) { args.push('--append-system-prompt', fs.readFileSync(bootstrap, 'utf8')); } const r = spawnSync(process.execPath, [entry, ...args], { stdio: 'inherit', env: cleanEnv, });The documented unattended workflow additionally directs callers to use:
sh --permission-mode bypassPermissionsSKILL.md:586-589states that unattended write runs must use this automatic-approval mode, while only requiring conversational authorization for specifically identified dangerous operations.Technical Analysis
The launcher unconditionally adds
--setting-sources project, causing CodeBuddy to load project-level settings from the target repository. The Skill documentation establishes that CodeBuddy settings can contain hooks and recommends project-only settings as the way to avoid problematic user-level hooks.In a repository obtained from or writable by an independent contributor, project settings are not necessarily trusted. Loading them crosses a trust boundary from repository content into executable agent configuration. This becomes particularly dangerous when the documented workflow also enables
bypassPermissions, suppressing the interactive approval controls normally available during an unattended write run.The script does not inspect project settings, reject hook definitions, constrain hook commands, or require approval before loading them. Its environment filtering removes selected inherited variables, but it does not prevent commands defined by ...[truncated 1792 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not load repository hooks by default. Use a generated, trusted settings file stored outside the target repository, or invoke CodeBuddy with a mode that disables hooks while retaining only the project settings required for the task.
- Separate settings from executable hooks. If project configuration is needed, parse it and reject hook-related fields before starting CodeBuddy.
- Do not combine unreviewed project settings with
bypassPermissions. Require an explicit opt-in after displaying the exact project configuration and hook commands that will be activated. - Apply an allowlist. Permit only documented, non-executable project settings unless the user separately approves each hook.
- Use sandboxing for unattended runs. Run the delegated CLI in a container or restricted account with a narrowly scoped workspace, minimal credentials, restricted network access, and no access to unrelated user files.
- Fail closed. If the launcher cannot prove that project hooks are absent or disabled, terminate unattended permission-bypassed runs with a clear diagnostic.
- Update the documentation. Clarify that project settings are a trust boundary and require review before operating on third-party or contributor-controlled repositories.
