Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(skills): close the two review blockers on the new skill channels

rubenluetke10-beep7da1e6535560
diff --git a/jarvis/skills/explicit_request.py b/jarvis/skills/explicit_request.py
index f3acad97f9..abe2861357 100644
--- a/jarvis/skills/explicit_request.py
+++ b/jarvis/skills/explicit_request.py
@@ -13,11 +13,13 @@ precision over recall. It fires only when ALL THREE hold:
1. an explicit use-verb ("nutz", "starte", "run", "use", "ejecuta", …),
2. the literal word "skill(s)" — the user is talking about the mechanism,
-3. an installed, active skill whose NAME is spoken in the utterance.
+3. an installed, active skill whose NAME is spoken in the utterance,
+4. and the utterance is NOT an informational question ("how do I use the X
+ skill?" must be answered, never executed — see the opener veto below).
"Welche skills habe ich?" has no use-verb; "erstell mir einen skill …" has no
resolvable installed name; "starte die morgenroutine" has no "skill" word and
-stays with the trigger/relevance channels. All three miss here by design.
+stays with the trigger/relevance channels. All of these miss by design.
Name matching is speech-tolerant: kebab-case names are compared as normalized
token sequences ("morning-routine" ↔ "morning routine"), and the namespace
@@ -40,18 +42,42 @@ from jarvis.skills.match_eval import (
from jarvis.skills.relevance import normalize_text
#: Imperative use-verbs in DE / EN / ES, matched against the RAW utterance
-#: (umlaut and digraph forms both listed). Deliberately excludes authoring
-#: verbs ("erstell", "bau", "create") — creating a skill is not running one.
+#: (umlaut and digraph forms both listed). Infinitives are included because
+#: polite modal phrasing is how people actually speak ("kannst du den Skill X
+#: nutzen"). Deliberately excludes authoring verbs ("erstell", "bau",
+#: "create") — creating a skill is not running one.
_EXPLICIT_VERB_RE = re.compile(
r"\b("
- r"nutz(?:e|t)?|benutz(?:e|t)?|verwende?|starte?|" # i18n-allow: speech-input vocabulary
- r"f[üu]hr(?:e|t)?|fuehre?|aktiviere?|" # i18n-allow: speech-input vocabulary
+ r"nutz(?:e|t|en)?|benutz(?:e|t|en)?|verwend(?:e|et|en)?|" # i18n-allow: speech-input vocabulary
+ r"start(?:e|et|en)?|f[üu]hr(?:e|t|en)?|fuehr(?:e|t|en)?|" # i18n-allow: speech-input vocabulary
+ r"aktivier(?:e|t|en)?|" # i18n-allow: speech-input vocabulary
r"run|use|execute|launch|trigger|invoke|activate|start|"
r"usa|ejecuta|lanza|activa" # i18n-allow: speech-input vocabulary
r")\b",
re.IGNORECASE,
)
+#: Informational question openers (DE / EN / ES), after an optional wake or
+#: politeness run. A question ABOUT a skill — "how do I use the cloud-debug
+#: skill?", or its German "what is it used for" form — # i18n-allow: example
+#: satisfies the verb + skill-word + name gates exactly like a command does,
+#: yet running the skill would be the wrong answer: for a mission skill it
+#: would silently dispatch a background worker off a question (review finding
+#: 2026-08-12). Only interrogative INFORMATION openers veto; polite-modal
+#: request forms ("kannst du …", "can you …") stay commands. Mirrors the
+#: manager's ``_QUESTION_OPENER_RE`` shape.
+_INFO_QUESTION_OPENER_RE = re.compile(
+ r"^\s*(?:(?:hey|hallo|hi|hello|ok(?:ay)?|bitte|please|jarvis)[\s,]+){0,3}"
+ r"(?:"
+ r"was|wie|wieso|warum|weshalb|wann|wer|wen|wem|wessen|" # i18n-allow: speech-input vocabulary
+ r"welche[rsnm]?|wof[üu]r|wofuer|wozu|woher|wohin|wo|" # i18n-allow: speech-input vocabulary
+ r"how|what|whats|why|which|who|whom|whose|when|where|"
+ r"qu[ée]|c[óo]mo|cu[áa]ndo|d[óo]nde|por\s+qu[ée]|" # i18n-allow: speech-input vocabulary
+ r"para\s+qu[ée]|qui[ée]n(?:es)?|cu[áa]l(?:es)?" # i18n-allow: speech-input vocabulary
+ r")\b",
+ re.IGNORECASE,
+)
+
#: The user must literally say "skill(s)" — same word DE/EN/ES. Mirrors the
#: pc-control gate's ``_EXPLICIT_SKILL_REQUEST_RE`` in the brain manager.
_SKILL_WORD_RE = re.compile(r"\bskills?\b", re.IGNORECASE)
@@ -101,6 +127,9 @@ def resolve_explicit_skill_request(
return None
if not _EXPLICIT_VERB_RE.search(utterance):
return None
+ if _INFO_QUESTION_OPENER_RE.match(utterance):
+ # A question about the skill must be ANSWERED, never executed.
+ return None
spoken = tuple(_TOKEN_RE.findall(normalize_text(utterance)))
if not spoken:
return None
diff --git a/jarvis/skills/prompt_injection.py b/jarvis/skills/prompt_injection.py
index 9310ade067..8be2b8faff 100644
--- a/jarvis/skills/prompt_injection.py
+++ b/jarvis/skills/prompt_injection.py
@@ -57,7 +57,7 @@ def _is_builtin(skill: object) -> bool:
from jarvis.skills.builtin import BUILTIN_SKILL_NAMES
return str(getattr(skill, "name", "")) in BUILTIN_SKILL_NAMES
- except Exception: # noqa: BLE001
+ except Exception: # noqa: BLE001 — import fault must not demote a user skill
return False
diff --git a/jarvis/ui/web/skills_routes.py b/jarvis/ui/web/skills_routes.py
index 774f5a2d81..151ddc6e72 100644
--- a/jarvis/ui/web/skills_routes.py
+++ b/jarvis/ui/web/skills_routes.py
@@ -456,6 +456,38 @@ async def commit_skill_draft(
_URL_RE = re.compile(r"https?://[^\s\"'<>]+")
+#: Charset an imported skill's frontmatter ``name`` must satisfy before it is
+#: used as an install folder name. ``SkillFrontmatter.name`` itself only
+#: requires non-empty, so without this gate a crafted ``name: ../../evil``
+#: (or an absolute path — ``Path(base) / "C:/..."`` discards the base) turns
+#: the import routes into an arbitrary-file-write primitive. Mirrors the slug
+#: rule in ``jarvis/skills/authoring/schema.py``.
+_IMPORT_NAME_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$")
+
+
+def _safe_import_target(name: str) -> Path:
+ """The install folder for an imported skill — guaranteed inside the root.
+
+ Raises ``HTTPException(400)`` on a name that is not a plain slug or that
+ resolves outside the user skills directory (path-traversal fail-closed).
+ """
+ if not _IMPORT_NAME_RE.match(name or ""):
+ raise HTTPException(
+ status_code=400,
+ detail=(
+ f"Skill name {name!r} is not a valid slug "
+ "(letters, digits, '-', '_'; max 64 chars)."
+ ),
+ )
+ base = user_skills_dir().resolve()
+ target = (base / name).resolve()
+ if target.parent != base:
+ raise HTTPException(
+ status_code=400,
+ detail=f"Skill name {name!r} resolves outside the skills directory.",
+ )
+ return target
+
def _extract_import_url(value: str) -> str:
match = _URL_RE.search(value.strip())
@@ -546,7 +578,7 @@ async def import_skill(body: SkillImportBody, request: Request) -> dict[str, Any
content = _rewrite_state_in_frontmatter(content, SkillLifecycleState.DRAFT.value)
- target_dir = user_skills_dir() / name
+ target_dir = _safe_import_target(name)
target_file = target_dir / "SKILL.md"
target_dir.mkdir(parents=True, exist_ok=True)
tmp_file = target_file.with_suffix(".md.tmp")
@@ -591,7 +623,7 @@ def _import_skill_folder(path_str: str, reg: Any) -> tuple[str, list[str]]:
status_code=400,
detail="This folder is already inside the Jarvis skills directory.",
)
- except OSError:
+ except OSError: # base dir unresolvable — skip this convenience check, not fatal
pass
parsed = parse_skill(skill_md)
@@ -609,7 +641,7 @@ def _import_skill_folder(path_str: str, reg: Any) -> tuple[str, list[str]]:
)
try:
reg.get(name)
- except KeyError:
+ except KeyError: # not installed yet — exactly what a fresh import needs
pass
else:
raise HTTPException(status_code=409, detail=f"Skill '{name}' already exists.")
@@ -629,7 +661,7 @@ def _import_skill_folder(path_str: str, reg: Any) -> tuple[str, list[str]]:
content, SkillLifecycleState.DRAFT.value
)
- target_dir = user_skills_dir() / name
+ target_dir = _safe_import_target(name)
try:
target_dir.mkdir(parents=True, exist_ok=True)
(target_dir / "SKILL.md").write_text(content, encoding="utf-8")
diff --git a/tests/unit/skills/test_explicit_request.py b/tests/unit/skills/test_explicit_request.py
index 2be9834879..a936c2fb60 100644
--- a/tests/unit/skills/test_explicit_request.py
+++ b/tests/unit/skills/test_explicit_request.py
@@ -136,3 +136,38 @@ def test_partial_namespaced_name_does_not_match() -> None:
def test_empty_and_none_inputs() -> None:
assert resolve_explicit_skill_request("", _REGISTRY) is None
assert resolve_explicit_skill_request("use the gmail skill", None) is None
+
+
+def test_informational_questions_never_execute() -> None:
+ """Review finding 2026-08-12: "how do I use the X skill?" satisfies the
+ verb + skill-word + name gates exactly like a command, but running the
+ skill (worst case: dispatching a background mission) would be the wrong
+ answer. The question-opener veto must catch every phrasing shape.
+ """
+ questions = [
+ "how do I use the gmail skill?",
+ "what does the skill morning-routine do",
+ "wofür benutzt man den skill morning-routine", # i18n-allow
+ "wie nutze ich den skill deep-work-mode", # i18n-allow
+ "warum startet der skill morning-routine nicht", # i18n-allow
+ "hey jarvis, how do I run the gcloud skill",
+ ]
+ for utterance in questions:
+ assert resolve_explicit_skill_request(utterance, _REGISTRY) is None, utterance
+
+
+def test_polite_modal_requests_still_resolve() -> None:
+ """"kannst du … nutzen" is a command in politeness clothing — it must NOT
+ be caught by the question veto (only information openers veto).
+ """
+ hit = resolve_explicit_skill_request(
+ "kannst du den skill morning routine nutzen", _REGISTRY # i18n-allow
+ )
+ assert hit is not None
+ assert hit[0].name == "morning-routine"
+
+ hit = resolve_explicit_skill_request(
+ "can you run the gmail skill for me", _REGISTRY
+ )
+ assert hit is not None
+ assert hit[0].name == "plugin-gmail"
diff --git a/tests/unit/web/test_skills_import_local_route.py b/tests/unit/web/test_skills_import_local_route.py
index 2035e41203..4cd8888087 100644
--- a/tests/unit/web/test_skills_import_local_route.py
+++ b/tests/unit/web/test_skills_import_local_route.py
@@ -169,3 +169,35 @@ async def test_importing_from_inside_the_skills_dir_is_refused(
with pytest.raises(HTTPException) as exc:
await routes.import_skill_from_path(body, request)
assert exc.value.status_code == 400
+
+
+ "evil_name",
+ [
+ "../../evil",
+ "..\\\\..\\\\evil",
+ "C:/Users/Public/evil",
+ "sub/dir",
+ "name with spaces",
+ ],
+)
+async def test_traversal_name_in_frontmatter_is_refused(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, evil_name: str
+) -> None:
+ """Review finding 2026-08-12 (BLOCKER): the frontmatter ``name`` becomes
+ the install folder, and pydantic only checks non-empty — a crafted
+ ``name: ../../evil`` (or an absolute path, which pathlib joins by
+ DISCARDING the base) must never produce a write outside the skills root.
+ """
+ content = _CLAUDE_CODE_STYLE.replace("my-own-skill", f'"{evil_name}"')
+ src = _write_source(tmp_path, content)
+ skills_root, _, request = _setup(tmp_path, monkeypatch)
+
+ body = routes.SkillImportLocalBody(path=str(src))
+ with pytest.raises(HTTPException) as exc:
+ await routes.import_skill_from_path(body, request)
+ assert exc.value.status_code == 400
+ # Nothing escaped: the only entries under tmp_path are the fixtures.
+ assert not (tmp_path / "evil").exists()
+ assert not list(skills_root.iterdir())
diff --git a/tests/unit/web/test_skills_import_route.py b/tests/unit/web/test_skills_import_route.py
index 18976de728..499ee2eaa2 100644
--- a/tests/unit/web/test_skills_import_route.py
+++ b/tests/unit/web/test_skills_import_route.py
@@ -127,3 +127,27 @@ async def test_import_preserves_the_body(
stored = (tmp_path / "remote-skill" / "SKILL.md").read_text(encoding="utf-8")
assert "Just a marker body." in stored
assert "description: a skill downloaded from the internet" in stored
+
+
+async def test_import_refuses_a_traversal_name(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Review finding 2026-08-12 (BLOCKER class): a remote SKILL.md declaring
+ ``name: ../../evil`` must never turn the install path into a write
+ outside the skills root.
+ """
+ payload = _NO_STATE.replace("name: remote-skill", 'name: "../../evil"')
+ monkeypatch.setattr("httpx.AsyncClient", _client_returning(payload))
+ skills_root = tmp_path / "skills-root"
+ skills_root.mkdir()
+ monkeypatch.setattr(routes, "user_skills_dir", lambda: skills_root)
+
+ from fastapi import HTTPException
+
+ body = routes.SkillImportBody(input="https://example.invalid/SKILL.md")
+ with pytest.raises(HTTPException) as exc:
+ await routes.import_skill(body, _request(_Registry()))
+ assert exc.value.status_code == 400
+ assert not (tmp_path / "evil").exists()
+ assert not list(skills_root.iterdir())