Skip to content

Guardrail for destructive-command so rm doesn't run unchallenged #604

Closed

Description

@springgga

jcode just deleted everything in my ~
guardrail is not a choice. it's a must!!!

Activity

  1. phenchua29 commented on Jul 25, 2026

    @phenchua29

    This issue ticket genuinely scares me. RIP your home dir. 💀

  2. added
    enhancement
    priority: high
    triage: needs-decision
    autonomous: no
    on Jul 27, 2026
  3. 1jehuang commented on Jul 27, 2026

    @1jehuang
    Owner

    Sorry that happened, and thanks for reporting it. Losing a home directory is exactly the outcome a coding agent must never produce, so this is being treated as high priority.

    I have labeled this for maintainer decision rather than patching something narrow myself. A destructive-command guardrail is a permission-model design question, not a one-line fix: it needs a decision on what is gated, how it interacts with non-interactive/run mode, and how it composes with the existing permission work tracked in #568 and #566. A half-measure here (for example, pattern-matching rm -rf) would give false confidence while still missing find -delete, shred, redirects, and shell expansions.

    To help scope it, if you still have the session: which command was actually executed, and was this an interactive TUI session or jcode run? No pressure if the transcript is gone.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  4. 1jehuang commented on Jul 27, 2026

    @1jehuang
    Owner

    is this real?

  5. 1jehuang commented on Jul 27, 2026

    @1jehuang
    Owner

    Update: I verified this is real and have opened a fix in #618.

    Confirmed the gap. Before changing anything I ran the shipped binary against a throwaway directory: rm -rf executed immediately, no prompt. The only gate in the tool path is an opt-in external pre_tool hook that is off by default, so nothing protected you. My earlier comment understated this by treating it as purely a design question.

    What #618 does. Two stages:

    1. A deterministic classifier that scores blast radius rather than matching command names, so find -delete, shred, dd, and truncating redirects are covered alongside rm.
    2. For irreversible commands reaching outside the working directory, the harness refuses once and asks the model which specific user request requires the deletion. It only proceeds if re-issued with a real justification, so a blind retry does not get through. For /, $HOME, credential directories, and device nodes it is a hard deny that no justification unlocks.

    Routine work like rm -rf target is deliberately untouched, since a guard that fires constantly is one people learn to click through.

    Tested live end to end, plus a 330-command sweep over every spelling of the home directory I could think of.

    @1jehuang still needs to review it, in particular where the confirm threshold sits and how it should behave in unattended jcode run. Sorry again about your home directory.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  6. added a commit that references this issue on Jul 27, 2026
    1b60506
  7. added 10 commits that reference this issue on Aug 30, 2026
    bb4cdaa
    ddcf069
    39cf330
    12af986
    5ed8406
    7cfe45f
    054c548
    7b56691
    651600f
    7aa8a42
  8. added 4 commits that reference this issue on Sep 18, 2026
    4c5e6c0
    234ab19
    56fa4bf
    98c6322
  9. added a commit that references this issue on Oct 9, 2026
    f497e3b
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

    autonomous: noenhancementpriority: hightriage: needs-decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions