molecule-core/platform/internal/channels
Molecule AI Backend Engineer 68c9b37048 feat(channels): add Slack adapter with webhook URL validation (#384)
Implement SlackAdapter satisfying the ChannelAdapter interface:
- ValidateConfig: rejects any webhook_url that doesn't start with
  https://hooks.slack.com/ — returns "invalid Slack webhook URL" so
  the handler surfaces 400 {"error":"invalid config: invalid Slack webhook URL"}
- SendMessage: HTTP POST JSON {"text":"..."} to the webhook URL with a
  10s timeout; rejects invalid-prefix URLs at send time too (defence in depth)
- ParseWebhook: handles both slash-command (form-encoded) and Events API
  (JSON) payloads; no-ops on url_verification and non-message events
- StartPolling: returns nil immediately (Slack doesn't support polling via
  Incoming Webhooks)

Register "slack" in the adapter registry. Twelve unit tests cover
Type/DisplayName, happy-path validation, every bad-URL variant (wrong scheme,
wrong host, SSRF lookalike, empty string), empty webhook in SendMessage,
StartPolling nil return, and registry lookup/listing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 11:14:31 +00:00
..
adapter.go initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
channels_test.go feat(channels): add Slack adapter with webhook URL validation (#384) 2026-04-16 11:14:31 +00:00
manager.go fix(security): scope PausePollersForToken to requesting workspace (closes #329) 2026-04-15 21:22:50 -07:00
registry.go feat(channels): add Slack adapter with webhook URL validation (#384) 2026-04-16 11:14:31 +00:00
secret_test.go fix(security): encrypt channel_config bot_token at rest (closes #319) 2026-04-15 21:09:34 -07:00
secret.go fix(security): encrypt channel_config bot_token at rest (closes #319) 2026-04-15 21:09:34 -07:00
slack.go feat(channels): add Slack adapter with webhook URL validation (#384) 2026-04-16 11:14:31 +00:00
telegram.go initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00