Skip to content

disk-hygiene: PowerShell guard false-positives on read-only Export-Csv into the plugin data dir, and the workaround bypasses the guard #5226

Closed

Description

@kyle-sexton

Problem

A worker subagent doing a read-only inventory tried to write its findings with Export-Csv into ~/.claude/plugins/data/disk-hygiene-melodic-software/. The PowerShell guard blocked it. The worker then started pwsh from the Bash lane and ran the same command there, which went through. This is both a false positive (the write target is the plugin's own data dir and the command deletes nothing) and a guard bypass (the same operation passes when wrapped in a Bash-launched pwsh).

Evidence

  • Worker blocked on the PowerShell lane for Export-Csv to the data dir; the same operation succeeded via bash -> pwsh.
  • The exact denial text was not captured, and which rule in skills/clean/scripts/destructive_guard.py matched is unknown. Someone reproducing this should capture the denial text.
  • Related known false positive: disk-hygiene: PowerShell belt asks on mutation words inside quoted strings #4226 (PowerShell belt asks on mutation words inside quoted strings). This one involves a cmdlet name, not a quoted string.

Expected

  • Read-only output cmdlets (Export-Csv, Out-File, Set-Content) targeting the plugin data dir are allowed, or asked once with a clear reason.
  • A pwsh process launched from Bash is judged by the same rules as the PowerShell tool, or the docs say plainly that it is not.

Proposed direction

(a) Allowlist writes whose resolved target is under --data-root. (b) Have the Bash-lane guard classify pwsh -Command and powershell -Command payloads through the PowerShell rule set.

Related: #4226, #4228 item 3, #3856.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K3VkbjLqtYZ6JtsQaDKP4v

Activity

  1. added
    needs-triage
    on Sep 29, 2026
  2. kyle-sexton commented on Oct 1, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-10-01): approved the recommendation ("go with recommended", the owner's reply to the batch decision page that listed this question and its recommendation).

    Question: how to resolve #5226 (Export-Csv write refused, and pwsh from Bash getting through).

    Chosen option A: close it. Part (a), the Export-Csv write into the plugin data dir being refused, is fixed by merged PR #5546 (guardrails 0.42.1). Part (b), pwsh launched from Bash getting through, is the belt not reaching subagents, which is tracked in #3856. Re-file with the captured denial text if it recurs.

    Next: closing as completed; a cross-reference to this issue is added on #3856.

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

    needs-triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions