Skip to content

[External Plugin]: block-destructive-commands #2774

Description

@open-coder-ai

Plugin name

block-destructive-commands

Short description

A Copilot pre-tool-use hook that denies destructive shell commands before they run — rm -rf targeting root, home, or absolute paths, git push --force, git reset --hard, git clean -f, kubectl delete, terraform destroy, and PowerShell/cmd recursive-force removals. It is enforcement, not advice: the hook exits non-zero and the client refuses the call.

GitHub repository

open-coder-ai/chock-copilot-plugins

Plugin path inside the repository

copilot/block-destructive-commands

Ref to review

v0.2.0

Commit SHA to review

3dcdac1af1c1c7bc15e9bcb18891788e56e55c49

Version

0.0.6

License identifier

Apache-2.0

Author name

open-coder-ai

Author URL

https://github.com/open-coder-ai

Homepage URL

https://github.com/open-coder-ai/chock

Keywords

chock
policy-as-code
security
guardrail
pre-tool-use
destructive-commands

Additional notes for reviewers

What it is. This plugin comes from Chock, open-source policy-as-code for AI coding agents. The package ships a PreToolUse hook plus a stdlib-only Python adapter and the guard script, so it is session-enforced in Copilot CLI and VS Code agent mode rather than advisory.

Honest fail posture (stated verbatim in the plugin's own description, not just here): the hook needs python3 and a usable shell on PATH. Without them, fail-open clients allow silently and fail-closed clients refuse matched commands; on Windows, the Microsoft Store python3 alias must be disabled or Python installed. The guard is a best-effort pattern filter — aliases, quoting, and unusual paths can evade it — so it is friction, not a security boundary. We state this rather than overclaim enforcement.

Provenance. The source repository is generated: every file is compiled from policy sources in chock-catalog by the framework, and CI regenerates from the catalog and fails on any difference, so a package cannot be hand-edited into something the catalog never published. Every package also passes claude plugin validate in CI. The guard script and hook adapter are byte-identical copies of their framework sources.

Update after first intake run. All three quality-gate failures are fixed at the source: the plugin now ships in the Agent Plugins 1.0 layout (plugin.json at the package root under copilot/), and the SKILL.md frontmatter metadata is a flat string-to-string map per the Agent Skills spec (the nested object vally rejected). The enforcing hook lives at com.github.copilot/hooks/hooks.json, the location VS Code documents for Agent Plugins hook bundles. The generator changes shipped in the open-source framework (open-coder-ai/chock#59) with tests pinning the spec constraints, so every future package stays conformant.

Scope of this submission. Chock publishes four enforcing guard plugins (block-destructive-commands, block-no-verify, protect-agent-config, protect-commit-privacy) in the same repository. This issue submits the first one; we are happy to submit the remaining three once this listing is reviewed, so you can assess the pattern on a single entry first. The plugins are also submitted to the Copilot plugins marketplace in github/copilot-plugins#77.

Submission checklist

  • The plugin lives in a public GitHub repository.
  • The ref and/or sha I provided is immutable (release tag and/or full 40-character commit SHA), not a branch.
  • This submission follows this repository's contribution, security, and responsible AI policies.
  • This plugin is not already listed in the Awesome Copilot marketplace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    external-pluginPublic external plugin submissionneeds-review:HIGHContributor reputation check flagged HIGH riskready-for-reviewSubmission passed intake validation and is ready for maintainer review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions