Skip to main content

Module hook_approval

Module hook_approval 

Source
Expand description

First-run approval gate for project-scoped [[hooks]].

Project .oxicode/settings.toml may contain hooks that execute arbitrary shell commands. To prevent supply-chain attacks via a cloned repo, the cli requires the user to approve the project’s hook list once. Approval is cached in ~/.oxicode/hooks_approved.toml keyed by repo path + a hash of the project settings file. If the settings file changes, the hash mismatches and the user is re-prompted.

The oxicode-sdk has no concept of “approved” — this gate is purely a product-layer policy.

Structs§

HookApprovalEntry
HookApprovalRegistry

Functions§

hash_settings
SHA-256 (hex) of the project settings file content.
prompt_for_approval
Read a Y/n line from stdin. Defaults to false (deny) on EOF or parse error. This matches Claude Code’s behavior of erring on the safe side.