Skip to content

disk-hygiene: guard hook launches via bare python — fails to run (fail-open risk) on python3-only hosts #380

Description

@kyle-sexton

Summary (highest priority — potential fail-open of the security guard)

The disk-hygiene clean skill launches its PreToolUse safety guard via the unqualified
interpreter python:

  • skills/clean/SKILL.md:12command: "python", args ["${CLAUDE_PLUGIN_ROOT}/skills/clean/scripts/destructive_guard.py"]

Stock macOS and many Linux distros ship only python3 (no python shim). If python is
unresolvable, the PreToolUse hook process cannot launch.

Two failure modes, both severe

  1. Fail-open (worst case): if Claude Code treats a hook-launch failure as non-blocking, the
    destructive guard never runs — rm -rf, engine apply, etc. are no longer intercepted on the
    very POSIX hosts the safety model relies on. The guard's whole purpose is defeated silently.
  2. Fail-closed: if hook-launch failure blocks, the plugin is entirely unusable (scan/preview/
    apply all denied) on those hosts.

Additionally, if a legacy python (2.x) resolves first, the guard crashes immediately on
from __future__, f-strings, and dict[str, object] annotations.

Note the irony: the guard discloses its own absolute sys.executable for the engine calls to use,
but the guard itself is bootstrapped by the unqualified python it warns against.

Suggested fix

  • Launch the hook via a resolvable 3.11+ interpreter: prefer python3, or a tiny launcher that
    resolves a suitable interpreter and execs the guard.
  • Confirm Claude Code's actual behavior on hook-launch failure (fail-open vs fail-closed) and, if
    fail-open, treat this as critical.
  • Add a regression test / setup:check probe that the hook's interpreter actually resolves (see the
    companion setup:check issue).

Severity

HIGH (security) — a security guard that may not run at all on POSIX hosts.
Found via a deep source audit prompted by a real Windows session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: securitySecurity-relevant: vulnerability, hardening, or disclosure follow-up.priority: highSignificant impact, or blocks an imminent release; staff this cycle.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions