Skip to content

CI: add a repo-wide gate rejecting exec-form hooks whose command is a bare non-portable executable name #2569

Description

@kyle-sexton

This defect class has now shipped three times in disk-hygiene alone, and each fix was verified by a test that encoded the defect as its contract.

The class

An exec-form hook (args present) resolves command as a bare PATH lookup. Per the hooks reference: "On Windows, exec form requires command to resolve to a real executable such as a .exe." Two Windows spellings fail:

  • "command": "bash" — resolves to the WSL relay System32\bash.exe before Git Bash; dies with execvpe(/bin/bash) failed.
  • "command": "python3" — commonly the zero-length WindowsApps\python3.exe App Execution Alias stub.

A failed hook launch is non-blocking, so a PreToolUse gate built this way silently enforces nothing.

History

plugins/claude-config/skills/audit/reference/audit-checklist.md Category D already carries this as an error row — and disk-hygiene violated it anyway, because a checklist a human reads is not a gate.

Proposal

Add scripts/check-hook-exec-form.sh plus a self-test, modelled directly on the existing scripts/check-hook-userconfig-argv.sh gate (same scope rules: default hooks/hooks.json, manifest-pointed hook configs, inline manifest hooks objects — and it should additionally cover SKILL.md / agent frontmatter hooks, which the userconfig gate does not). Fail on any exec-form hook whose command contains no path separator and is not on a small allowlist of names that are real executables on every targeted platform (node, python via an absolute path, etc.), with a documented escape-hatch allowlist file that can only shrink.

Wire it as its own CI job with the self-test-first, fail-closed pattern the userconfig-argv gate uses.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions