Skip to content

libpilot: register the webhook plugin in the embedded daemon - #39

Merged
TeoSlayer merged 1 commit into
mainfrom
sec/findings-libpilot
Jul 26, 2026
Merged

libpilot: register the webhook plugin in the embedded daemon#39
TeoSlayer merged 1 commit into
mainfrom
sec/findings-libpilot

Conversation

@TeoSlayer

Copy link
Copy Markdown
Contributor

What

PilotSetWebhook forwards to the daemon's set-webhook IPC command, which calls Daemon.SetWebhookURL. That method returns immediately when no WebhookManager is registered — and the embedded daemon registered only three of the daemon's plugins (trustedagents, handshake, policy), never webhook. Result: the call was acknowledged with a success reply and then discarded, and no events were ever delivered.

Changes

  • Construct and register webhook.NewService("") alongside the existing three plugins, and install the daemon-side WebhookManager adapter so SetWebhookURL has a target.
  • Move plugin composition out of the cgo file into a new plugins.go (no import "C"), because Go test files cannot compile against a cgo import — this is what makes the composition testable at all.
  • Replace the "mirrors cmd/daemon composition root" comment with the actual set, plus why skillinject and the app-store supervisor are deliberately not part of a daemon running inside a host application process.

Tests

zz_plugins_test.go:

  • asserts the registered plugin set is trustedagents, handshake, policy, webhook
  • asserts Daemon.SetWebhookURL now reaches the plugin (observed via the URL the plugin persists), in both the set and clear directions
  • covers the registration-error path and the nil receiver

Both webhook tests fail without the registration and pass with it.

Notes

  • Adds github.com/pilot-protocol/webhook v0.2.0 — the same version pilotprotocol itself depends on.
  • No behaviour change for callers that never set a webhook URL.
  • go build ./... && go test -race -count=1 ./... green.

🤖 Generated with Claude Code

PilotSetWebhook forwards to the daemon's set-webhook IPC command, which
calls Daemon.SetWebhookURL. That method returns immediately when no
WebhookManager is registered, so on an embedded daemon the call was
acknowledged and then discarded: callers got a success reply and no
events were ever delivered.

Construct and register the webhook plugin alongside the trust, handshake
and policy plugins, and install the daemon-side adapter so SetWebhookURL
has a target. Composition moves out of the cgo file into plugins.go so it
can be exercised from a Go test (test files cannot import "C"), and the
"mirrors cmd/daemon composition root" comment is replaced with the actual
set plus why skillinject and the app-store supervisor are left out of a
daemon running inside a host application process.

Tests cover the registered set and assert that SetWebhookURL now reaches
the plugin, in both the set and clear directions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer
TeoSlayer merged commit 5cdb14e into main Jul 26, 2026
5 checks passed
@TeoSlayer
TeoSlayer deleted the sec/findings-libpilot branch July 26, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants