Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tools/skills_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,20 @@ def _skill_lookup_path_error(name: str) -> Optional[str]:
or PureWindowsPath(candidate).is_absolute()
or PureWindowsPath(candidate).drive
):
return "Skill name must be a relative path within the skills directory."
# Allow absolute paths that resolve within trusted directories.
# Cron jobs legitimately store absolute paths for skills outside
# ~/.hermes/skills/ (e.g. symlinked trading-skills repos or
# profile-scoped directories).
from hermes_constants import get_hermes_home

_hermes_home = get_hermes_home()
_trusted_roots = (
str(_hermes_home / "skills") + "/",
str(_hermes_home / "profiles") + "/",
)
resolved = str(Path(candidate).resolve())
if not resolved.startswith(_trusted_roots):
return "Skill name must be a relative path within the skills directory."
if has_traversal_component(candidate):
return "Skill name cannot contain '..' path traversal components."
return None
Expand Down
Loading