Files
openclaw/extensions/file-transfer
Yuval Dinodia f6582dfb5e fix(file-transfer): denyPaths does not deny listing the denied directory itself (#109233)
* fix(file-transfer): deny listing the directory a denyPaths rule names

A denyPaths entry like "**/.ssh/**" did not deny dir.list on the denied
directory itself, so listing /home/me/.ssh returned its full contents,
including filenames such as id_rsa and authorized_keys. Only paths strictly
under the directory were denied.

The deny gate matched the requested path against the globs as a plain string,
and a trailing /** requires something after the separator, so the bare
directory never matched. Every command routes its path through
evaluateFilePolicy, but dir.list is where it is observable, since its payload
is the directory's own contents. dir.fetch was incidentally safe because it
rechecks each returned entry, and those entries do match; dir.list has no
such recheck.

Match the deny globs against the directory form of the path at that one gate.
The check stays deny-side only, so it can fail closed but never open.

* test(file-transfer): cover denied directory path forms

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-16 22:22:01 -07:00
..