Skip to content

feat(deepagents): add interrupt mode to filesystem permissions#589

Open
Christian Bromann (christian-bromann) wants to merge 6 commits into
mainfrom
cb/fs-permissions-interrupt-9517
Open

feat(deepagents): add interrupt mode to filesystem permissions#589
Christian Bromann (christian-bromann) wants to merge 6 commits into
mainfrom
cb/fs-permissions-interrupt-9517

Conversation

@christian-bromann

Copy link
Copy Markdown
Member

Summary

  • Add mode: "interrupt" to FilesystemPermission, pausing matching filesystem tool calls for human approval instead of denying or running silently.
  • Auto-install HumanInTheLoopMiddleware in createDeepAgent when any interrupt-mode permission rule exists; merge fs-derived interruptOn with user interruptOn (user wins per tool name) on the main agent, GP subagent, and declarative subagents.
  • Introduce scope-aware when predicates in middleware/fs-interrupt.ts so interrupts fire only when calls intersect protected paths—literal match for exact tools (read_file, write_file, edit_file) and subtree overlap for bulk tools (ls, glob, grep), including fixes for pathless calls, current-dir aliases (., "", ./), and absolute ** glob patterns.
  • Bump langchain and @langchain/core to 1.4.5-dev-1781048185730 / 1.1.49-dev-1781048185730 for when predicate support (JS HITL uses approve / edit / reject; no Python respond decision yet).

Port langchain-ai/deepagents#3505 to deepagentsjs.

- Add mode="interrupt" to FilesystemPermission for HITL-gated access
- Auto-install HumanInTheLoopMiddleware when interrupt rules are present
- Merge fs-derived interruptOn configs with user interruptOn (user wins)
- Scope-aware when predicates for exact and bulk filesystem tools
- Security hardening: pathless grep, current-dir aliases, absolute glob patterns
- Bump langchain to 1.4.5-dev-1781048185730 for when predicate support
@changeset-bot

changeset-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 94bded3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
deepagents Minor
deepagents-acp Patch
@deepagents/evals Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread libs/deepagents/src/permissions/path-utils.ts Fixed

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open SWE Review found 1 potential issue.

Open in WebView Open SWE trace

Comment thread libs/deepagents/src/middleware/fs-interrupt.ts Outdated
Bulk when predicates previously collected anchors from every interrupt
rule, so allow carve-outs listed before a broader interrupt rule still
triggered HITL on bulk tools like ls/glob/grep.

Evaluate probe paths with decidePathAccess instead, matching exact-tool
and result-filtering semantics.
Replace /\/+$/ with a linear scan in path-utils and fs-interrupt to
avoid slow regex evaluation on paths with long runs of trailing slashes.

@corridor-security corridor-security Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Issues

  • Glob permission bypass via absolute traversal patterns
    The bulkPatternFires predicate in fs-interrupt.ts evaluates absolute glob patterns (those starting with /) by calling globAnchor() then pathsOverlap(), but never checks for .. segments before doing so. globAnchor treats .. as a literal path component and stops at it only if a wildcard appears first — it performs no normalization. As a result, a pattern like /workspace/../secrets/** produces the anchor /workspace/../secrets, whose components (workspace, .., secrets) do not prefix-match the protected anchor /secrets, so pathsOverlap returns false and the HITL interrupt is skipped entirely. The .. guard only fires on the non-absolute (else) branch at line 70, making it dead code for any absolute traversal pattern. A glob backend that resolves .. (e.g., micromatch in permissive mode, or the OS filesystem) will then enumerate the protected paths without human approval.

Recommendation

  • In bulkPatternFires, check for .. segments before the absolute-pattern branch (or immediately inside it), so any traversal-containing pattern unconditionally triggers the interrupt. Alternatively, normalize the raw pattern with path.resolve or a POSIX normalize equivalent before calling globAnchor, so that /workspace/../secrets/** collapses to /secrets/** and the overlap check fires correctly.

Comment thread libs/deepagents/src/middleware/fs-interrupt.ts Outdated
@pkg-pr-new

pkg-pr-new Bot commented Jun 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

deepagents-acp

npm i https://pkg.pr.new/deepagents-acp@589

deepagents

npm i https://pkg.pr.new/deepagents@589

@langchain/sandbox-standard-tests

npm i https://pkg.pr.new/@langchain/sandbox-standard-tests@589

@langchain/daytona

npm i https://pkg.pr.new/@langchain/daytona@589

@langchain/deno

npm i https://pkg.pr.new/@langchain/deno@589

@langchain/modal

npm i https://pkg.pr.new/@langchain/modal@589

@langchain/node-vfs

npm i https://pkg.pr.new/@langchain/node-vfs@589

@langchain/quickjs

npm i https://pkg.pr.new/@langchain/quickjs@589

commit: 94bded3

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedlangchain@​1.4.5-dev-178104818573010010093100100
Added@​langchain/​core@​1.1.49-dev-1781048185730100100100100100

View full report

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants