Skip to content

disk-hygiene: destructive_guard.py literal-$ authorized-path support in the shell tokenizer (PR #742 follow-up) #1035

Description

@kyle-sexton

This was generated by AI during triage (#657 sweep housekeeping, T8h batch conversion).

Origin: PR #742 review thread (destructive_guard.py line 141). Folded from a #657 line (checked off there, this issue is the target).

Problem

Literal-$ authorized-path support is missing in the disk-hygiene destructive guard. Repro: _literal_shell_words (plugins/disk-hygiene/skills/clean/scripts/destructive_guard.py, around L56-59) blanket-rejects any command containing $, so an authorized --data-root whose CLAUDE_PLUGIN_DATA path contains a literal $ is rejected before parsing — scan/preview/apply fail closed for those installs despite the argv authority.

Current behavior is fail-closed/fail-loud (deny with visible reason) — over-blocking, the safe direction, outside DEFER-FORBIDDEN. Deferred deliberately by the reporter, not a quick fix.

Fix direction (from the reporting review thread)

Allow $ only inside a single-quoted literal word (bash does NOT expand $ in single quotes; it DOES inside double quotes) — requires a quote-aware tokenizer that still rejects real expansion/$(...)/backtick syntax.

Why this is needs-human, not a mechanical batch fix

This is a change to a security-relevant guard's tokenizer. The stated fix direction is a single design, but it must be implemented and adversarially reviewed by a human before merge — the exact bar this repo already applies to guard-tokenizer changes (see #903/#964's chained-alias-bypass caution: a plausible-looking carve-out in a value/shape guard is exactly the class of change that has reopened bypasses before here). Getting the quote-aware tokenizer wrong (e.g., missing a $(...)-inside-single-quotes edge case, or a mixed-quote word) would silently reopen the injection vector the blanket check exists to block — that is a genuine security review call, not a mechanical rename/consolidation.

Question for the human: does the single-quoted-literal carve-out as scoped above cover the real-world CLAUDE_PLUGIN_DATA-contains-$ cases this repo needs to support, or is the safer path to instead document the $-in-path restriction as an accepted limitation (parallel to #1013's resolution for the guardrails value-blindness case) and tell affected installs to avoid $ in their data-root path?

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.wayfind: designWayfind decision item: design-space or domain-model decision; human in the loop.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions