T09 · Insecure Skill Coding Practices
- Location
references/deploy-codex.md:32- Finding
Automation guidance bypasses trust for preserved project-controlled Codex hooks
- Content
View full analysis
Vulnerability Details
File Location:
references/deploy-codex.md, lines 32 and 50
Vulnerability Type: Execution of unreviewed project hooks through a trust-gate bypass
Risk Level: HighComplete Vulnerable Snippet
text Line 32: 保留用户已有的非 story-setup hooks、matcher 块与未知顶层字段。 Line 50: 自动化里的 `codex exec` 可加 `--dangerously-bypass-hook-trust`The instructions state that existing non-story-setup hooks and unknown configuration fields must be preserved. They later recommend that automation may invoke
codex execwith--dangerously-bypass-hook-trust.Technical Analysis
Project-local Codex hook configuration is an executable trust boundary. The deployment process intentionally preserves hook registrations that are not managed by this Skill. Such entries may originate from repository contributors rather than from the user running the automation.
Under the normal workflow, Codex’s hook trust mechanism provides a review and approval gate before these commands execute. The documented
--dangerously-bypass-hook-trustoption removes that gate for automation. Combining preserved project-controlled hooks with this option means that automation may execute commands that were neither installed nor validated by story-setup.The issue is not the legitimate installation of the Skill’s own hooks. It arises because the bypass applies broadly while arbitrary existing hook entries remain in the resulting configuration.
Attack Path
- An attacker with the ability to contribute files to a repository adds or modifies a non-story-setup command hook in
.codex/hooks.json. - The victim deploys or updates story-setup. Following line 32, the deployment preserves the attacker-controlled hook because it is not recognized as a managed story-setup entry.
- The repository is processed by automation using the documented
codex exec --dangerously-bypass-hook-trustoption. - Codex skips the normal review and trust decision for project hooks.
- The attac ...[truncated 983 chars]
- An attacker with the ability to contribute files to a repository adds or modifies a non-story-setup command hook in
- Remediation
View remediation
Remediation Suggestions
- Remove the recommendation to use
--dangerously-bypass-hook-trust. - Require normal Codex review and trust approval for project-local hooks, including in automation.
- If noninteractive execution is required, generate a dedicated automation hook configuration containing only exact story-setup-managed registrations.
- Validate hook identities, executable paths, arguments, and configuration schema before enabling them.
- Reject or disable unknown project hook entries in unattended environments rather than preserving and executing them.
- Run automation with a least-privileged account, a minimal environment, restricted filesystem access, and no unnecessary service credentials.
- Document that repositories and their
.codex/hooks.jsonfiles must be treated as executable content rather than passive configuration.
- Remove the recommendation to use
