mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
chore: debug log for untrusted absolute skill paths; drop misleading test patch
Review findings: (a) an absolute path outside trusted roots passes through unchanged and gets rejected downstream by skill_view — add a debug log at the pass-through so the cron 'skill not found' symptom is diagnosable next time; (b) test_relative_path_unchanged patched get_skills_dir although the relative branch early-returns before any root lookup — drop the misleading patch.
This commit is contained in:
parent
713e50e7d2
commit
2c5762f575
2 changed files with 6 additions and 1 deletions
|
|
@ -556,6 +556,11 @@ def normalize_skill_lookup_name(identifier: str) -> str:
|
|||
try:
|
||||
return str(identifier_path.resolve().relative_to(primary_root.resolve()))
|
||||
except Exception:
|
||||
logger.debug(
|
||||
"Skill identifier %r is an absolute path outside trusted skills "
|
||||
"roots — passing through unchanged (skill_view will reject it)",
|
||||
raw_identifier,
|
||||
)
|
||||
return raw_identifier
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ class TestNormalizeSkillLookupName:
|
|||
def test_relative_path_unchanged(self, tmp_path, monkeypatch):
|
||||
from agent.skill_utils import normalize_skill_lookup_name
|
||||
|
||||
monkeypatch.setattr("agent.skill_utils.get_skills_dir", lambda: tmp_path / "skills")
|
||||
# Relative identifiers early-return before any root lookup.
|
||||
assert normalize_skill_lookup_name("foo/bar") == "foo/bar"
|
||||
|
||||
def test_absolute_under_skills_dir_becomes_relative(self, tmp_path, monkeypatch):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue