Repository navigation
Description
Symptom. For a Column connector, deliveries to /realtime/outgoing_transfer/manual_review_approved and /realtime/outgoing_transfer/manual_review_rejected can fail signature verification on every attempt. The API answers 500, Column retries ("up to 25 times within 3 days") and then drops the event. A payout that Column rejected after manual review stays where the manual_review event left it, and polling doesn't re-read it.
Cause. verifyAndTrimWebhook takes the first webhook config whose URLPath is a substring of the request path (engine.go#L1316-L1324). The Column plugin registers one endpoint per event, and /realtime/outgoing_transfer/manual_review is a prefix of the two longer paths (column/webhook.go#L219-L230). Column gives each endpoint its own secret, which is stored in its config. WebhooksConfigsGetFromConnectorID has no ORDER BY (webhooks_configs.go#L50-L58), and the configs are created in Go map order. Whenever manual_review comes back before one of its longer siblings, that sibling's delivery is checked against the manual_review secret. The result is ErrWebhookVerification and a 500.
Repro. A test in internal/api/v3 that goes through the real router, the engine and the Column plugin with real HMAC verification. Column's POST /webhook-endpoints is an httptest server that returns a different secret per endpoint, and the storage mock returns exactly the configs the plugin created. Each of the 41 endpoints gets an event signed with its own secret, on its own path:
- configs ordered by name:
manual_review_approvedandmanual_review_rejectedget HTTP 500, the other 39 get 200; - the same configs in reverse order (control): all 41 get 200;
- configs in the order the plugin created them, over 200 fresh installs: in three runs, 121, 136 and 192 of the 200 installs had at least one of the two endpoints failing.
Reproduced on main as of 2026-10-23.
Fix. Pick the most specific match instead of the first one:
--- a/internal/connectors/engine/engine.go
+++ b/internal/connectors/engine/engine.go
@@ -1319,8 +1319,9 @@ func (e *engine) verifyAndTrimWebhook(ctx context.Context, urlPath string, webho
continue
}
- config = &c
- break
+ if config == nil || len(c.URLPath) > len(config.URLPath) {
+ config = &c
+ }
}With this, all three cases above pass, and ./internal/connectors/engine/ and ./internal/api/v3/ stay green. Mangopay needs the same rule, since /transfer/failed is contained in /refund/transfer/failed. Matching the path suffix exactly would be stricter still.
Possibly related. Even when routed correctly, mapTransactionStatus has no case for manual_review_rejected (column/payments.go#L116-L139), so it would map to UNKNOWN. I couldn't confirm which status Column puts on the transfer object after a manual rejection, so I haven't tested that part.
I can send the test as a PR if that's useful.
Activity