fix: resolve skill_id from bus context in spec and legacy detach handlers - #101
fix: resolve skill_id from bus context in spec and legacy detach handlers#101JarbasAl wants to merge 2 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Ping! I've got your results right here. 🛎️I've aggregated the results of the automated checks for this PR below. ⚖️ License CheckI've checked the license history of this repo. 📜 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 🏷️ Release PreviewI've checked the release assets for completeness. 💾 Current:
✅ PR title follows conventional commit format. 🚀 Release Channel Compatibility Predicted next version:
🔌 Skill Tests (ovoscope)Testing the skill's 'offline' capabilities (if any). 🔌 ❌ 8/20 passed, 12 failed ❌ **TestDetach** — 0/2
❌ **TestEntityExtraction** — 0/1
❌ **TestLegacyStillConsumed** — 0/1
❌ **TestRegisteredIntentMatch** — 1/4
❌ **TestSessionBlacklist** — 0/2
❌ **TestSessionBlacklistAlias** — 0/3
🚌 Bus CoverageMeasuring the reach of our bus handlers. 📏 📊 CoverageQuantifying the quality of our test suite. 🧪 ✅ 82.4% total coverage Per-file coverage (3 files)
Full report: download the 📋 Repo HealthChecking the repo's cholesterol levels (aka code bloat). 🥩 ✅ All required files present. Latest Version: ✅ 🔒 Security (pip-audit)Scanning for any potential denial-of-service vectors. 🚫 ✅ No known vulnerabilities found (49 packages scanned). 🔍 LintI've finished the heavy lifting on this check. 🏋️♂️ ❌ ruff: issues found — see job log 🔌 Plugin DetectionI've verified the plugin's 'hot-reload' performance. 🔥 ❌ Plugin Status: ERRORS (1) Plugin Info:
OPM Detection:
Entry Point Validation:
⊘ No Issues:
🔨 Build TestsConstruction of your features is officially finished. 🏠 ✅ All versions pass
Processing... Done! Have a productive day! ☕ |
65faa45 to
085ef79
Compare
handle_detach_skill selected intents to remove with `skill_id in i`, a substring test over the full "<skill_id>:<name>" intent name. A skill whose id is a substring of another skill's id (e.g. "me" against "skill-a.me") wiped the other skill's intents when it detached, and an unregistered id like "skill" cleared every intent containing that text. The entity branch of the same handler already matched on the "<skill_id>:" prefix, as do adapt and padatious. Intents are now selected with startswith(skill_id + ":"), the colon being the intent-name namespace separator (OVOS-MSG-1 §2.1.1), so the owner of "a.b:c" is exactly "a.b". Regression test test/test_detach_skill_prefix.py: 2 failed before the fix (registered_intents emptied to [] in both cases), 2 pass after. Full suite: 90 passed, 2 skipped. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
79b8029 to
f580359
Compare
…lers handle_register_template, handle_register_entity, handle_deregister_intent, handle_deregister_entity, handle_deregister_skill and the legacy handle_detach_skill trusted message.data['skill_id'] unconditionally, so a payload disagreeing with message.context['skill_id'] silently acted under another skill's name. The bus client twins ovos.skill.deregister into the legacy detach_skill topic carrying the original context, so guarding only the spec handler left the legacy twin as a bypass: on FakeBus with ovos-bus-client 2.11.14a2, ovos.skill.deregister with data.skill_id=victim and context.skill_id=attacker still removed the victim's intents. Add module-level _skill_id_from_context(message, handler): when context carries a skill_id it is used regardless of the payload (a mismatch is logged at WARNING and never acted on); when context carries no skill_id the payload value is trusted, which is where this helper diverges from the ovos_adapt and ovos_padatious twins (those return None). Wire it into the five spec handlers and into handle_detach_skill. The legacy handle_detach_intent, twinned from ovos.intent.deregister with the producer's context, compares the intent_name owner prefix against context.skill_id and rejects a mismatch, with the same guard condition as ovos_adapt and ovos_padatious: a truthy context skill_id AND a namespaced intent_name. A bare unnamespaced name or an empty-string context keeps the pre-spec detach. Fail-before against origin/dev (tests kept, source reverted): 4 failed / 9 passed of the detach/deregister set; the bus-emitted deregister case fails with [] != ['victim.skill:play_music']. After: 13 passed. Full suite 109 passed, 12 failed (on top of padacioso#102, whose prefix match handle_detach_skill keeps); origin/dev in the same venv is 96 passed, 12 failed with the identical failed set (ovoscope register_padatious_intent skill_id kwarg drift, tracked in padacioso#97). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
f580359 to
ef3a64a
Compare
handle_register_template,handle_register_entity,handle_deregister_intent,handle_deregister_entity,handle_deregister_skilland the legacyhandle_detach_skilltrustedmessage.data['skill_id']unconditionally and ignoredmessage.context['skill_id'], so a payload naming another skill acted under that skill's name. Guarding only the spec handler is not enough: the bus client twinsovos.skill.deregisterinto the legacydetach_skilltopic while forwarding the producer's original context. On aFakeBuswith ovos-bus-client 2.11.14a2, anovos.skill.deregisterwithdata.skill_id=victimandcontext.skill_id=attackerstill removed the victim's intents through that twin. This is the same integrity hole OVOS-INTENT-4 §3.2 names, on legacy topics the spec does not cover.A module-level
_skill_id_from_context(message, handler)resolves the skill id: when the context carries askill_id, that value is used regardless of the payload, and a mismatch is logged atWARNINGnaming both values and the topic but never acted on. When the context carries noskill_idat all, the payload value is trusted. That no-context branch is where padacioso deliberately diverges from theovos_adaptandovos_padatioustwins, which returnNonethere; a pre-spec producer keeps its real id instead of having its registration dropped. The helper is wired into the five spec handlers and intohandle_detach_skill, matching howovos_adaptandovos_padatiousroute their legacydetach_skill. This branch is based on padacioso#102 and assumes it merges first:handle_detach_skillkeeps #102's prefix match and only changes whereskill_idcomes from.The legacy
handle_detach_intent, twinned fromovos.intent.deregisterwith the producer's context, compares the<skill_id>:prefix ofintent_nameagainstcontext.skill_idand rejects a mismatch. The guard condition is the same one adapt#75 and padatious#152 use: a truthy context skill_id AND a namespacedintent_name. A bare unnamespaced name or an empty-string context skill_id falls through to the pre-spec detach, so the three engines resolve the same legacy message the same way.Eleven tests in
test/test_pipeline.pyassert the roster by value. Theovos.skill.deregistercase is emitted through the bus so it reaches thedetach_skilltwin, and asserts the victim's intents survive and still match.detach_intentis covered by forged prefix rejected, matching prefix detaches, no context keeps legacy behaviour, plus the bare-name and empty-context parity cases. With the tests kept and the source reverted toorigin/dev, 4 of the 13 detach/deregister tests fail (the bus-emitted deregister fails with[] != ['victim.skill:play_music']); after the fix all 13 pass.Full suite: 109 passed, 12 failed.
origin/devin the same venv is 96 passed, 12 failed with the identical failed set: every failure isregister_padatious_intent() missing 1 required keyword-only argument: 'skill_id'from the ovoscope e2e files, the kwarg drift padacioso#97 addresses. This branch does not touch those files.