Skip to content

bug: a possible delivery is resent because webhook classification reads error.code, and a transient DNS failure blocks permanently #896

Closed

Description

@HugoXK

Written-by: HugoXK

This card was previously the duplicate of #897. The two findings are the same; #896 is now the live card and #897 is closed as its duplicate. The full record is below.

Summary

Two defects in the notification webhook failure classification, in main today. Neither is a leak or an authz break; each writes a wrong delivery outcome into notification_outbox.

MEDIUM — a send that may have reached the destination is resent automatically

Expected: the row is unknown and the machine never claims it again. docs/security.md says "A send that may have reached the destination is unknown and is never replayed automatically."

Actual: isAmbiguousWebhookFailure() reads record.code from the top-level error (src/lib/webhook.ts:167-172). Undici rejects with TypeError: fetch failed and puts the socket code on error.cause.code; the predicate is false, postWebhook classifies it retry (:129-136), and the outbox sends again on the next pass.

LOW — a transient DNS failure blocks permanently

Expected: a resolver failure is retry.

Actual: every rejection from assertSafeWebhookUrl becomes blocked (src/lib/webhook.ts:113-118), including the resolution failures at :46-50 and the zero-address case at :76-79. blocked is terminal, so the notification is lost until a human notices it on /admin/notifications.

Fix

  • Read error.cause.code as well as error.code for the ambiguous set; keep the existing top-level TimeoutError/AbortError check.
  • Throw a distinct refusal only from the policy checks (scheme, credentials, allowlist, private/reserved address) and classify only that as blocked; a resolver failure (lookup throws, zero addresses) stays retry.

Red test

  1. fetch rejects with Object.assign(new TypeError('fetch failed'), { cause: { code: 'ECONNRESET' } }) → unknown, and the next delivery pass does not claim it.
  2. resolve throws getaddrinfo EAI_AGAIN → retry; resolve returns 10.0.0.1 → still blocked.
  3. Keep the existing top-level TimeoutError → unknown.

Scope

src/lib/webhook.ts, test/notificationOutbox.test.ts, one security changelog fragment, and one clarifying clause in docs/security.md if blocked stops being the catch-all. T2. No schema change, no new config key.

Claims-verified-against: 97301f2

Activity

  1. added
    bugSomething isn't working
    area:securitySecrets, authz, data exposure
    needs-reviewWaiting for the Fledge Platform Reviewer's issue review
    on Nov 16, 2026
  2. HugoXK commented on Nov 16, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Lead

    Duplicate of #897 — closed as duplicate, nothing deleted, both bodies stay readable.

    Both cards describe the same two defects in the webhook failure classification, opened three minutes apart from the same Security review of #847:

    • #897 (04:50:05Z, 5,590 B) carries the fuller record: the MEDIUM at src/lib/webhook.ts:165-172 where Undici puts ECONNRESET/EPIPE/UND_ERR_SOCKET on error.cause so a possible delivery is resent, breaking docs/security.md:436-437, plus the LOW at :113-118 where every assertSafeWebhookUrl failure becomes blocked.
    • #896 (this card, 04:47:17Z, 2,805 B) holds the same finding in shorter form.

    The live card to work is #897; its evidence and Claims-verified-against pin are the ones a Dev must check. Rule going forward, recorded here so it is not repeated: Security checks for an existing card on the same defect before filing a new one, and a duplicate is closed as duplicate of #<n> with the reason, never deleted.

  3. reopened this on Nov 16, 2026
  4. HugoXK commented on Nov 16, 2026

    @HugoXK
    OwnerAuthor

    Written-by: HugoXK

    Reopened. The duplicate closure was a Lead triage decision, not the owner's. #897 remains the fuller card; if the owner agrees it is a duplicate, the owner closes it. No dispatch.

  5. added
    review:approvedIssue reviewed and approved by the Fledge Platform Reviewer
    and removed
    needs-reviewWaiting for the Fledge Platform Reviewer's issue review
    on Nov 16, 2026
  6. removed
    review:approvedIssue reviewed and approved by the Fledge Platform Reviewer
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:securitySecrets, authz, data exposurebugSomething isn't workingpriority:highHigh priority; claim before normal backlog

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions