Stashbase

Dependency install hooks

Check packages before coding agents install them

Stashbase can install dependency-security hooks for Codex, Claude, and Cursor. A hook checks supported package-install commands before they run, so an agent can be stopped before it installs a blocked dependency.

Enable dependency checking

Dependency checking is opt-in per agent profile. Add dependency_check to the profile's top-level allow_hooks list:

.stashbase/agents/coding.toml
allow_hooks = ["dependency_check"]

egress_hosts = ["registry.npmjs.org", "registry.yarnpkg.com"]

[filesystem]
deny_read = [".env", "~/.ssh", "~/.aws"]
deny_write = [".git", "~/.ssh", "~/.aws"]

Installing a hook alone does not grant it access to the Stashbase API. During stashbase agent run, the parent CLI keeps the API key and gives the hook a short-lived token for one exact local dependency-check route. The hook cannot retrieve secret values or use other Stashbase API routes.

If the capability is enabled but no Stashbase API key is available, Stashbase starts the agent and warns that dependency checks are disabled. This avoids turning an unauthenticated local or egress-only profile into failed install commands.

Install a hook

Install a hook in the current repository for the agent you use:

stashbase agent hooks deps install codex
stashbase agent hooks deps install claude
stashbase agent hooks deps install cursor

Use --global to install the selected hook for all repositories:

stashbase agent hooks deps install codex --global

dependencies is accepted as an alias for deps.

Check or remove an installed hook with the same scope. check exits unsuccessfully when the hook is missing; remove is an alias for uninstall.

stashbase agent hooks deps check codex
stashbase agent hooks deps uninstall codex
stashbase agent hooks deps uninstall codex --global

What a hook checks

The hooks support npm, Bun, pnpm, and Yarn install and add commands, including project-wide installs such as npm ci and bare npm install.

For package-specific installs, Stashbase checks the requested package name and exact version when one is present. For project-wide installs, it checks only direct dependencies in the root package.json. It resolves exact versions from supported lockfiles when possible, including npm package-lock.json v1, v2, and v3 and pnpm lockfiles. This lets a lockfile version take precedence over a broad manifest range such as ^4.17.0.

This is a pre-install control, not a full dependency-tree audit: it does not inspect transitive dependencies or replace lockfile review, provenance verification, CI scanning, or registry protections. A blocked result stops the install before it runs. Warnings are shown, and whether the install continues follows the coding agent's hook behavior.

Run with the profile

Start the agent through Stashbase with the profile that enables the hook:

stashbase agent run --profile coding --profile-source directory -- codex

See Profile configuration for egress and filesystem policy, and Run and secure agents for starting and validating sessions.

On this page