Skip to content

/add-knowledge: powershell *Copy-Item* pre-approval is broader than needed #37

Description

Summary

The /add-knowledge command frontmatter pre-authorizes:

allowed-tools: Read, Write, Glob, Grep, Bash(mkdir *), Bash(cp *), Bash(powershell *Copy-Item*), Bash(node *verify-knowledge-access.bundle.js*)

(commands/add-knowledge.md, line 4.)

Bash(powershell *Copy-Item*) is broader than the workflow needs. The only documented use of PowerShell in the command body is a single copy step — "uploaded file → copy the file into capabilities/knowledge/files/" — and Bash(cp *) is already allowed in the same line for it.

Why the wildcard shape over-grants

The pattern matches any command that starts with powershell and contains Copy-Item anywhere. A -Command string that continues after the copy with additional statements still matches:

powershell -Command "Copy-Item a b; <any additional statement>"

Pre-approved tools in the command frontmatter run without a per-command confirmation prompt in the host CLI, so in a session where the assistant is steered by workspace or web content, the practical effect is "any PowerShell command whose text mentions Copy-Item", not "the one copy step".

Suggested tightening

Any of these would match the documented need:

  • Drop the entry entirely — the documented step is a plain file copy already covered by Bash(cp *).
  • Constrain the destination: Bash(powershell *Copy-Item*capabilities/knowledge/files*).
  • Allow only a structured two-path form with no free continuation (e.g. Bash(powershell *Copy-Item * capabilities/knowledge/files/*)), accepting the small false-positive cost of ordering.

The narrower the pre-approval, the less a steered session can do without the user seeing a prompt.

Verified at HEAD a0833db3 (default branch main), 2026-09-20.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions