Files
hermes-agent/tools
kshitijk4poor 7d9cb0ac51 fix(file_ops): guard the directory entry that V4A Delete/Move now act on
Delete and Move remove or rename the directory entry itself (a symlink,
not its target), but get_write_denied_error realpaths its argument, so it
only ever vetted the link's target. A link outside HERMES_WRITE_SAFE_ROOT
(or inside ~/.hermes/sessions) pointing at a file inside the root passed
the guard and the link was deleted/renamed outside the allowed area.

delete_file and move_file now also run the same guard on each entry's
parent directory, which realpaths to where the entry really lives.

The symlink test gains a safe-root case (red without this change), and
its Move cases always assert success, the rename, the link target and
files_modified instead of tolerating a refusing move primitive; expected
values are parameters rather than header introspection, and json is a
module-level import.
2026-09-27 01:10:56 +05:30
..