Commit ef3a64a
fix: resolve skill_id from bus context in spec and legacy detach handlers
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>1 parent 98e0f2c commit ef3a64a
2 files changed
Lines changed: 196 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
283 | 290 | | |
284 | 291 | | |
285 | 292 | | |
286 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
287 | 304 | | |
288 | 305 | | |
289 | 306 | | |
| |||
300 | 317 | | |
301 | 318 | | |
302 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
303 | 324 | | |
304 | 325 | | |
305 | 326 | | |
306 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
307 | 330 | | |
308 | 331 | | |
309 | 332 | | |
| |||
450 | 473 | | |
451 | 474 | | |
452 | 475 | | |
453 | | - | |
| 476 | + | |
454 | 477 | | |
455 | 478 | | |
456 | 479 | | |
| |||
494 | 517 | | |
495 | 518 | | |
496 | 519 | | |
497 | | - | |
| 520 | + | |
498 | 521 | | |
499 | 522 | | |
500 | 523 | | |
| |||
535 | 558 | | |
536 | 559 | | |
537 | 560 | | |
538 | | - | |
| 561 | + | |
539 | 562 | | |
540 | 563 | | |
541 | 564 | | |
| |||
544 | 567 | | |
545 | 568 | | |
546 | 569 | | |
547 | | - | |
| 570 | + | |
548 | 571 | | |
549 | 572 | | |
550 | 573 | | |
| |||
554 | 577 | | |
555 | 578 | | |
556 | 579 | | |
557 | | - | |
| 580 | + | |
558 | 581 | | |
559 | 582 | | |
560 | 583 | | |
| |||
731 | 754 | | |
732 | 755 | | |
733 | 756 | | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
734 | 787 | | |
735 | 788 | | |
736 | 789 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
220 | 356 | | |
221 | 357 | | |
222 | 358 | | |
| |||
0 commit comments