-
Notifications
You must be signed in to change notification settings - Fork 0
feat(kanban): board webhooks — registration + HMAC outbound delivery #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
288b59b
feat(kanban): board webhooks — registration + HMAC outbound delivery
cnjack c1ec124
Merge branch 'main' into feat/kanban-d2-webhooks
cnjack 85b1a6c
fix(kanban): harden webhook SSRF guard (review #44)
cnjack e18419e
Merge remote-tracking branch 'origin/main' into feat/kanban-d2-webhooks
cnjack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| DROP TABLE IF EXISTS kanban_webhook_deliveries; | ||
| DROP TABLE IF EXISTS kanban_webhooks; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| CREATE TABLE kanban_webhooks ( | ||
| id CHAR(36) NOT NULL, | ||
| workspace_id CHAR(36) NOT NULL, | ||
| board_id CHAR(36) NULL, | ||
| name VARCHAR(160) NOT NULL, | ||
| target_url VARCHAR(2048) NOT NULL, | ||
| secret CHAR(64) NOT NULL, | ||
| event_types JSON NOT NULL, | ||
| enabled TINYINT(1) NOT NULL DEFAULT 1, | ||
| created_by_user_id CHAR(36) NOT NULL, | ||
| last_delivery_at TIMESTAMP NULL, | ||
| last_status VARCHAR(32) NULL, | ||
| created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (id), | ||
| KEY idx_webhooks_workspace (workspace_id), | ||
| KEY idx_webhooks_enabled (workspace_id, enabled), | ||
| CONSTRAINT kanban_webhooks_workspace_fk FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE, | ||
| CONSTRAINT kanban_webhooks_board_fk FOREIGN KEY (board_id) REFERENCES kanban_boards(id) ON DELETE CASCADE, | ||
| CONSTRAINT kanban_webhooks_creator_fk FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE CASCADE | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
|
|
||
| CREATE TABLE kanban_webhook_deliveries ( | ||
| id CHAR(36) NOT NULL, | ||
| webhook_id CHAR(36) NOT NULL, | ||
| workspace_id CHAR(36) NOT NULL, | ||
| event_type VARCHAR(64) NOT NULL, | ||
| payload JSON NOT NULL, | ||
| status ENUM('pending','succeeded','failed','dead') NOT NULL DEFAULT 'pending', | ||
| attempt_count INT NOT NULL DEFAULT 0, | ||
| max_attempts INT NOT NULL DEFAULT 6, | ||
| last_status_code INT NULL, | ||
| last_error VARCHAR(512) NULL, | ||
| next_retry_at TIMESTAMP NULL, | ||
| created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (id), | ||
| KEY idx_deliveries_webhook (webhook_id), | ||
| KEY idx_deliveries_due (status, next_retry_at), | ||
| CONSTRAINT kanban_deliveries_webhook_fk FOREIGN KEY (webhook_id) REFERENCES kanban_webhooks(id) ON DELETE CASCADE, | ||
| CONSTRAINT kanban_deliveries_workspace_fk FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ pub mod card; | |
| pub mod column; | ||
| pub mod comment; | ||
| pub mod label; | ||
| pub mod webhook; | ||
|
|
||
| use sqlx::Row; | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Webhook enqueue is non-atomic with the card mutation commit.
These paths commit the card change first, then enqueue webhook delivery rows. A crash/restart in that window persists the card mutation but drops the webhook event, breaking event consistency.
Suggested direction
Apply the same transactional outbox pattern to create/move/archive so state change and event enqueue succeed or fail together.
Also applies to: 733-741, 874-882
🤖 Prompt for AI Agents