fix(webhook): validate the payment id and never log it #151
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-payment!151
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "fix/139-webhook-validate-id"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
What
POST /webhooks/mollienow accepts only ids matching^tr_[A-Za-z0-9]+$. Anything else gets 200 with no Mollie call.parseCallbackreturns no events whenpayments.getanswers 404, so an unknown id also gets 200, as the Mollie docs recommend. Only that call is covered. A 404 on the refund listing for a real payment still fails and Mollie retries.The failure log is now the fixed line
[webhook] failed. The raw id and the SDK message are never logged. A crafted id can no longer forge a line that matches theBillingReconcileManualReviewalert.Other failures still return 500 so Mollie retries.
Tests
src/server.test.ts: invalid ids (forged log text,tr_,tr_a/b,pay_1) return 200 and make no provider call. A provider failure returns 500 and the log line has neither the id nor the SDK message.src/provider/mollie.test.ts: a 404 frompayments.get, built with the SDK'sApiError, gives no events.All fail without the fix.
pnpm lint,pnpm typecheckandpnpm testpass.Closes #139