Skip to content
youdede

Install lifecycle script guard

SecurityHookv1.0.0

A deterministic Claude Code PreToolUse gate that reconstructs package manifest edits and rejects net-new preinstall, install, postinstall, prepare, prepublish, and prepublishOnly script entries without executing package code.

Runs on

Scope
$npx @youdede/toolkit add install-lifecycle-script-guard --target claude-code

What it does

Block newly introduced package lifecycle commands that execute during dependency installation.

When it fires

  • implementation
  • review
  • maintenance

How it behaves

Compare bounded package manifest edits and reject net-new dependency-install lifecycle execution surfaces.

It does not execute, sandbox, review, rewrite, or approve any package script.

It does not claim that non-lifecycle scripts or existing lifecycle scripts are safe.

It does not infer authorization from script names, comments, environment variables, or prompt text.

It does not provide an agent-controlled exception file or inline bypass.

Configuration

targets/claude-code/install-lifecycle-script-guard.mjsnode · read-only

Version
1.0.0
Requires
Shell command guard
Licence
RiskThis automatic gate blocks newly introduced package lifecycle commands that execute during dependency installation; a false denial can interrupt legitimate work, but it does not execute the blocked action.
Medium
ModeHow it works: fixed rules, model instructions, or both.
Deterministic only
Behaviour
Enforces, blocks on violation
On failure
Denies and blocks
LatencyThe entrypoint handles one intercepted event to block newly introduced package lifecycle commands that execute during dependency installation without deferred work.
Immediate
Data retentionWhether data remains after use and who manages its storage.
Not retained

Often used with

All in Security