fix(webhook): validate the payment id and never log it #139

Stängd
öppnade 2026-10-12 13:14:55 +00:00 av supernaut · 0 kommentarer
Ägare

POST /webhooks/mollie passes any id to payments.get (src/server.ts:72-84). On error it logs [webhook] failed: ${rootMessage(error)}, and the SDK error repeats the id (The payment id appears invalid: <value>).

Failing cases:

  • id=[reconcile] x needs manual review writes a log line that matches the BillingReconcileManualReview alert. One request pages the operator.
  • An unknown tr_ id costs one authenticated Mollie read and returns 500. Repeated, it spends the account's shared rate-limit bucket.

Mollie:

To not leak any information to malicious third parties, it is recommended to return a 200 OK response even if the ID is not known to your system.

https://docs.mollie.com/reference/webhooks

Fix in server.ts:

  • Accept only ^tr_[A-Za-z0-9]+$. Return 200 for anything else, with no API call.
  • Map a Mollie 404 to 200.
  • Never log the raw id or the SDK message. Log a fixed string and the status code.

While payments are disabled the endpoint returns 503 first, so this is not reachable today.

`POST /webhooks/mollie` passes any `id` to `payments.get` (`src/server.ts:72-84`). On error it logs `[webhook] failed: ${rootMessage(error)}`, and the SDK error repeats the id (`The payment id appears invalid: <value>`). Failing cases: - `id=[reconcile] x needs manual review` writes a log line that matches the `BillingReconcileManualReview` alert. One request pages the operator. - An unknown `tr_` id costs one authenticated Mollie read and returns 500. Repeated, it spends the account's shared rate-limit bucket. Mollie: > To not leak any information to malicious third parties, it is recommended to return a `200 OK` response even if the ID is not known to your system. https://docs.mollie.com/reference/webhooks Fix in `server.ts`: - Accept only `^tr_[A-Za-z0-9]+$`. Return 200 for anything else, with no API call. - Map a Mollie 404 to 200. - Never log the raw id or the SDK message. Log a fixed string and the status code. While payments are disabled the endpoint returns 503 first, so this is not reachable today.
supernaut lade till detta till projektet Bitborg Payment 2026-10-12 13:16:09 +00:00
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment#139
Ingen beskrivning angiven.