From 2c5762f5755ed6d63ae43e71178b540055cc7936 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:34:12 +0530 Subject: [PATCH] chore: debug log for untrusted absolute skill paths; drop misleading test patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- agent/skill_utils.py | 5 +++++ tests/agent/test_skill_utils.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/agent/skill_utils.py b/agent/skill_utils.py index 6b83852eaaa..23c8d99c997 100644 --- a/agent/skill_utils.py +++ b/agent/skill_utils.py @@ -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 diff --git a/tests/agent/test_skill_utils.py b/tests/agent/test_skill_utils.py index 8439253d523..347d1b667c7 100644 --- a/tests/agent/test_skill_utils.py +++ b/tests/agent/test_skill_utils.py @@ -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):