Re-export verify_webhook and add ColonyVerifyWebhook tool#15
Merged
jackparnell merged 1 commit intomainfrom Apr 9, 2026
Merged
Re-export verify_webhook and add ColonyVerifyWebhook tool#15jackparnell merged 1 commit intomainfrom
jackparnell merged 1 commit intomainfrom
Conversation
The colony-sdk 1.5.0 release shipped a verify_webhook helper for HMAC signature verification on incoming webhook deliveries. This PR exposes it from crewai_colony so crews that act as webhook receivers don't have to import directly from colony_sdk. - verify_webhook is re-exported (not re-wrapped) so callers pick up any future SDK security fixes automatically. - ColonyVerifyWebhook BaseTool wraps it for crew use — accepts payload, signature, secret kwargs and returns "OK — signature valid" or "Error — signature invalid". Standalone tool, not in ALL_TOOLS (same pattern as ColonyRegister — instantiate directly when needed). - 13 new tests covering: re-export identity, valid/invalid sigs, sha256= prefix tolerance, str vs bytes payloads, sync + async tool paths, and a defensive catch around verify_webhook itself. 204 tests passing, 100% coverage held. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Small PR — exposes the
verify_webhookHMAC helper that landed incolony-sdk1.5.0 fromcrewai_colony, plus aBaseToolwrapper for crews that act as webhook receivers.Design notes
verify_webhookis re-exported rather than re-wrapped so any future security fixes in the SDK automatically apply here.crewai_colony.verify_webhook is colony_sdk.verify_webhook— covered by a test.ColonyVerifyWebhookis a standalone tool, not inALL_TOOLS/READ_TOOLS/WRITE_TOOLS. Same pattern asColonyRegister— webhook verification doesn't need an authenticated client and isn't something a normal Colony crew does, so it shouldn't be auto-included inColonyToolkit().get_tools()(which would otherwise force every crew to think about asecretparameter that's irrelevant to them). Instantiate it directly when you need it.hmac.compare_digest,sha256=prefix tolerance, andbytesorstrpayloads — all delegated to the SDK function.Test plan
pytest— 204 passed (191 → 204, +13 new tests intest_verify_webhook.py)pytest --cov— 100% across all 6 source filesruff checkcleanruff format --checkcleanmypy src/cleanTest coverage: re-export identity, valid/invalid sigs,
sha256=prefix tolerance,strvsbytespayloads, sync + async tool paths, defensive catch aroundverify_webhook, and a test that assertsColonyVerifyWebhookis not inALL_TOOLS.Last code PR before v0.6.0. Up next: PR 4 (release automation via OIDC + Dependabot), then cut the release.
🤖 Generated with Claude Code