{
  "id": "ku_cf8ec10c4286d0a22d1cea5f63305a9f",
  "version": 1,
  "domains": [
    "x402",
    "seller",
    "security",
    "hooks"
  ],
  "insight": {
    "summary": "Your extension's check in beforeVerify or beforeSettle crashed, and instead of stopping the payment the server verified and settled it.",
    "detail": "A hook can return { abort: true } to stop a payment, but a throw was only logged and the loop continued, so a check that could not finish failed open. From 2.30.0 a throw in those two phases stops the payment with reason extension_hook_error; advisory phases still log and continue.",
    "action": "Upgrade @x402/core to 2.30.0 or later. On older versions, catch inside your gate hooks and return { abort: true }."
  },
  "context": {
    "languages": [
      "typescript"
    ],
    "frameworks": [
      "@x402/core"
    ],
    "pattern": "security-patch"
  },
  "evidence": {
    "confidence": 0.85,
    "confirmations": 1,
    "first_observed": "2026-11-04T00:00:00Z",
    "last_confirmed": "2026-12-02T00:00:00Z"
  },
  "tier": "public",
  "created_by": "neomorphic:house",
  "flags": [],
  "extensions": {
    "neomorphic:title": "x402 beforeVerify or beforeSettle hook throws, and the payment goes through anyway",
    "neomorphic:signature": {
      "surface": "x402",
      "provider": "x402-core",
      "code": "gate-hook-throw-fails-open",
      "versions": "fixed in @x402/core 2.30.0",
      "environment": "resource server hooks and extensions",
      "key": "x402/x402-core/gate-hook-throw-fails-open"
    },
    "neomorphic:status": "fixed",
    "neomorphic:fix": {
      "summary": "Upgrade @x402/core to 2.30.0 or later. On older versions, catch inside your gate hooks and return { abort: true }.",
      "snippet": {
        "lang": "ts",
        "text": "server.onBeforeVerify(async (ctx) => {\n  try {\n    if (!(await myCheck(ctx))) return { abort: true, reason: 'check_failed' };\n  } catch (e) {\n    return { abort: true, reason: 'check_error' };   // fail closed before 2.30.0\n  }\n});"
      }
    },
    "neomorphic:fixed_in": "@x402/core 2.30.0",
    "neomorphic:sources": [
      {
        "kind": "issue",
        "url": "https://github.com/x402-foundation/x402/issues/3689",
        "observed_at": "2026-12-02",
        "note": "A throwing beforeVerify or beforeSettle hook is ignored, so extension gates fail open; closed 2026-11-04."
      },
      {
        "kind": "pull-request",
        "url": "https://github.com/x402-foundation/x402/pull/3702",
        "observed_at": "2026-12-02",
        "note": "Merged 2026-11-04: fail closed when a gate hook throws (extension_hook_error)."
      },
      {
        "kind": "release",
        "url": "https://www.npmjs.com/package/@x402/core/v/2.30.0",
        "observed_at": "2026-12-02",
        "note": "@x402/core 2.30.0, published 2026-11-04: the first release after the fix merged."
      }
    ],
    "neomorphic:author": {
      "kind": "house",
      "name": "Neomorphic"
    },
    "neomorphic:escalation": "seller",
    "neomorphic:observed_at": "2026-11-04",
    "neomorphic:updated_at": "2026-12-02",
    "neomorphic:stale_after": "2027-06-01"
  }
}
