{
 "name": "Codzee head-to-head scores",
 "date": "2026-11-30",
 "judge": "Martian Code Review Bench pipeline (extract, dedup, judge), Claude Opus 4.5",
 "pull_requests": [
  {
   "original_pr": 1,
   "tools": {
    "codzee": {
     "found": 5,
     "extra": 0,
     "matched": [
      {
       "known_issue": "GET /customers/:customerId/orders only checks that x-customer-id is present and never compares it with req.params.customerId, so any signed-in customer can read another customer's order history by changing the id in the path.",
       "tool_claim": "Any customer can read anyone's order history - GET /:customerId/orders handler only checks that x-customer-id is present but doesn't verify the current customer matches the requested customerId, allowing cross-customer data exposure"
      },
      {
       "known_issue": "PATCH /customers/:customerId never calls currentCustomer() or checks ownership, so anyone (even without x-customer-id) can change any customer's name or email, which enables account takeover through the email address.",
       "tool_claim": "Unauthenticated PATCH rewrites any customer - PATCH /:customerId handler never calls currentCustomer, allowing anyone to change any customer's email and name without authentication, enabling account takeover"
      },
      {
       "known_issue": "Pagination offset is computed as page * PAGE_SIZE while page defaults to 1, so the default request skips the ten newest orders and a customer with ten or fewer orders gets an empty list; it should be (page - 1) * PAGE_SIZE.",
       "tool_claim": "Page 1 skips the newest ten orders - pagination offset uses page * PAGE_SIZE with default page of 1, starting at index 10 instead of 0, so newest orders are never shown"
      },
      {
       "known_issue": "The page query parameter is passed through Number() with no validation, so ?page=abc yields NaN (empty list, page: null, 200 OK) and negative or fractional values return wrong slices instead of a 400.",
       "tool_claim": "Invalid page values give wrong slices - page query parameter is not validated, so NaN, negative numbers, or decimals produce empty or misaligned results with 200 status"
      },
      {
       "known_issue": "PATCH /customers/:customerId stores any string as email or name with no validation, so an empty string or a non-email value can replace the customer's email address.",
       "tool_claim": "Profile fields stored without validation - PATCH handler accepts any string for email and name without validating email format or limiting name length"
      }
     ],
     "extra_claims": [],
     "missed": []
    },
    "coderabbit": {
     "found": 3,
     "extra": 1,
     "matched": [
      {
       "known_issue": "GET /customers/:customerId/orders only checks that x-customer-id is present and never compares it with req.params.customerId, so any signed-in customer can read another customer's order history by changing the id in the path.",
       "tool_claim": "IDOR vulnerability in customer orders route: If customer A requests /customers/B/orders, A's identity passes the check but B's orders are returned, allowing unauthorized access to another customer's order history"
      },
      {
       "known_issue": "PATCH /customers/:customerId never calls currentCustomer() or checks ownership, so anyone (even without x-customer-id) can change any customer's name or email, which enables account takeover through the email address.",
       "tool_claim": "IDOR vulnerability in profile update route: PATCH /customers/B allows customer A to modify customer B's profile without authorization check, as the handler only checks target existence and string types but not caller ownership"
      },
      {
       "known_issue": "Pagination offset is computed as page * PAGE_SIZE while page defaults to 1, so the default request skips the ten newest orders and a customer with ten or fewer orders gets an empty list; it should be (page - 1) * PAGE_SIZE.",
       "tool_claim": "Pagination offset calculation is incorrect: Line 23 defaults page to 1 but calculation starts at index 10, causing customers with one order to receive empty order list and customers with more orders to miss their newest ten orders on default page. Should use (page - 1) * PAGE_SIZE"
      }
     ],
     "extra_claims": [
      "Self-lookup route treats customer header as identity without verifying deployment prevents clients from supplying that header directly to the application"
     ],
     "missed": [
      "The page query parameter is passed through Number() with no validation, so ?page=abc yields NaN (empty list, page: null, 200 OK) and negative or fractional values return wrong slices instead of a 400.",
      "PATCH /customers/:customerId stores any string as email or name with no validation, so an empty string or a non-email value can replace the customer's email address."
     ]
    },
    "greptile": {
     "found": 5,
     "extra": 0,
     "matched": [
      {
       "known_issue": "GET /customers/:customerId/orders only checks that x-customer-id is present and never compares it with req.params.customerId, so any signed-in customer can read another customer's order history by changing the id in the path.",
       "tool_claim": "Other customers' orders are exposed - A signed-in customer can read another customer's purchases by changing customerId in the URL. The guard checks only that x-customer-id exists, while the filter uses the unrelated URL value. Require the signed-in customer to match the requested customer before reading orders."
      },
      {
       "known_issue": "PATCH /customers/:customerId never calls currentCustomer() or checks ownership, so anyone (even without x-customer-id) can change any customer's name or email, which enables account takeover through the email address.",
       "tool_claim": "Other customers' profiles can change - PATCH /customers/:customerId changes the customer selected by the URL without checking who is signed in. A caller can overwrite another customer's name or email, even when the gateway supplies a valid identity for a different customer."
      },
      {
       "known_issue": "Pagination offset is computed as page * PAGE_SIZE while page defaults to 1, so the default request skips the ten newest orders and a customer with ten or fewer orders gets an empty list; it should be (page - 1) * PAGE_SIZE.",
       "tool_claim": "Newest ten orders are skipped - The default page is 1, but page * PAGE_SIZE starts that page at order 11. Customers with ten or fewer orders get an empty history, and larger histories omit the newest ten orders from normal page navigation. Use (page - 1) * PAGE_SIZE for the offset."
      },
      {
       "known_issue": "The page query parameter is passed through Number() with no validation, so ?page=abc yields NaN (empty list, page: null, 200 OK) and negative or fractional values return wrong slices instead of a 400.",
       "tool_claim": "Invalid pages look successful - Number(req.query.page ?? 1) accepts invalid page values without rejecting them. For example, ?page=abc produces NaN, so the response reports page: null and returns an empty list. Fractional pages return overlapping windows. Require a positive safe integer and return 400 otherwise."
      },
      {
       "known_issue": "PATCH /customers/:customerId stores any string as email or name with no validation, so an empty string or a non-email value can replace the customer's email address.",
       "tool_claim": "Invalid email replaces saved address - The email check accepts every string, including empty string and 'not-an-email', and immediately replaces the saved address. Check that the supplied value is an email address before changing the customer, and reject invalid values without overwriting the existing address."
      }
     ],
     "extra_claims": [],
     "missed": []
    },
    "codeant": {
     "found": 2,
     "extra": 1,
     "matched": [
      {
       "known_issue": "GET /customers/:customerId/orders only checks that x-customer-id is present and never compares it with req.params.customerId, so any signed-in customer can read another customer's order history by changing the id in the path.",
       "tool_claim": "Authorization check only verifies that some customer ID is present, allowing a signed-in customer to request another customer's ID and read their order history"
      },
      {
       "known_issue": "Pagination offset is computed as page * PAGE_SIZE while page defaults to 1, so the default request skips the ten newest orders and a customer with ten or fewer orders gets an empty list; it should be (page - 1) * PAGE_SIZE.",
       "tool_claim": "Pagination off-by-one error: with pages starting at 1, the code skips the first ten orders on page 1 and returns wrong orders for every page"
      }
     ],
     "extra_claims": [
      "If a PATCH request has no parsed JSON body, req.body is undefined and the dereference throws an error"
     ],
     "missed": [
      "PATCH /customers/:customerId never calls currentCustomer() or checks ownership, so anyone (even without x-customer-id) can change any customer's name or email, which enables account takeover through the email address.",
      "The page query parameter is passed through Number() with no validation, so ?page=abc yields NaN (empty list, page: null, 200 OK) and negative or fractional values return wrong slices instead of a 400.",
      "PATCH /customers/:customerId stores any string as email or name with no validation, so an empty string or a non-email value can replace the customer's email address."
     ]
    }
   }
  },
  {
   "original_pr": 2,
   "tools": {
    "codzee": {
     "found": 8,
     "extra": 2,
     "matched": [
      {
       "known_issue": "POST /products/coupons has no authentication or admin check, so any caller can create a 100%-off coupon (or rewrite an existing one) and then redeem it on POST /orders for free goods.",
       "tool_claim": "POST /products/coupons endpoint has no authentication or admin check, allowing anyone to create coupons including 100% discount coupons"
      },
      {
       "known_issue": "stackedTotals deduplicates with new Set(codes) before upper-casing, so ['WELCOME10','welcome10','Welcome10'] survives as three entries and the same coupon is applied three times, contradicting 'duplicates are ignored'.",
       "tool_claim": "Case variants of coupon codes defeat duplicate removal - same coupon with different cases applies multiple times"
      },
      {
       "known_issue": "stackedTotals sums each coupon's percent of the full subtotal with no cap, so discountCents can exceed subtotalCents and totalCents goes negative (e.g. two 60% campaign coupons).",
       "tool_claim": "Stacked discounts can exceed the subtotal, causing negative order totals when multiple coupons are applied"
      },
      {
       "known_issue": "POST /products/coupons only checks typeof percentOff === 'number' and never checks minSubtotalCents, so negative or >100 percentages and non-numeric minimums are stored and corrupt order pricing (a negative percent raises totals, >100 makes them negative).",
       "tool_claim": "Coupon percentOff is not range-checked (should be 1-100), allowing values like 500 (negative totals) or -50 (surcharges)"
      },
      {
       "known_issue": "createCoupon writes COUPONS[code.toUpperCase()] without checking for an existing entry, so posting 'welcome10' silently overwrites the built-in WELCOME10/BIGBASKET rules for every later order.",
       "tool_claim": "createCoupon silently overwrites existing coupons without existence check"
      },
      {
       "known_issue": "The returned applied field is the full deduplicated input list, so unknown codes and coupons skipped for minSubtotalCents are stored on the order and reported as applied.",
       "tool_claim": "applied field lists all submitted coupon codes including unknown ones and ones that didn't meet minSubtotalCents threshold"
      },
      {
       "known_issue": "The three-coupon limit is applied with slice(0, MAX_COUPONS) before codes are validated and the zod schema has no .max(3), so extra codes are silently dropped instead of rejected and invalid codes can push a valid fourth code out.",
       "tool_claim": "More than three coupons are silently truncated with no error returned to client"
      },
      {
       "known_issue": "Replacing couponCode with couponCodes in the CreateOrder schema means existing clients that still send couponCode get a 201 with the field silently stripped and no discount, rather than an error.",
       "tool_claim": "Old couponCode field is silently ignored due to zod stripping unknown keys, causing clients to lose discounts without error"
      }
     ],
     "extra_claims": [
      "minSubtotalCents is not type-checked and coupon code may be empty",
      "Anyone can cancel or read any order without authentication - cancel handler and GET /:id have no auth checks"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 4,
     "extra": 0,
     "matched": [
      {
       "known_issue": "POST /products/coupons has no authentication or admin check, so any caller can create a 100%-off coupon (or rewrite an existing one) and then redeem it on POST /orders for free goods.",
       "tool_claim": "POST /products/coupons endpoint has no admin authorization check - any caller can create or replace coupons with arbitrary percentOff values including 100%"
      },
      {
       "known_issue": "stackedTotals deduplicates with new Set(codes) before upper-casing, so ['WELCOME10','welcome10','Welcome10'] survives as three entries and the same coupon is applied three times, contradicting 'duplicates are ignored'.",
       "tool_claim": "Coupon codes are not normalized to uppercase before deduplication - case variants like WELCOME10 and welcome10 are treated as separate coupons allowing duplicate discounts"
      },
      {
       "known_issue": "stackedTotals sums each coupon's percent of the full subtotal with no cap, so discountCents can exceed subtotalCents and totalCents goes negative (e.g. two 60% campaign coupons).",
       "tool_claim": "Stacked discounts can exceed the subtotal resulting in negative totalCents - two 60% coupons on a 2800 subtotal produces discountCents=3360 and totalCents=-560"
      },
      {
       "known_issue": "POST /products/coupons only checks typeof percentOff === 'number' and never checks minSubtotalCents, so negative or >100 percentages and non-numeric minimums are stored and corrupt order pricing (a negative percent raises totals, >100 makes them negative).",
       "tool_claim": "percentOff validation does not reject negative values or values above 100 - percentOff=-10 passes validation and can increase order totals instead of discounting"
      }
     ],
     "extra_claims": [],
     "missed": [
      "createCoupon writes COUPONS[code.toUpperCase()] without checking for an existing entry, so posting 'welcome10' silently overwrites the built-in WELCOME10/BIGBASKET rules for every later order.",
      "The returned applied field is the full deduplicated input list, so unknown codes and coupons skipped for minSubtotalCents are stored on the order and reported as applied.",
      "The three-coupon limit is applied with slice(0, MAX_COUPONS) before codes are validated and the zod schema has no .max(3), so extra codes are silently dropped instead of rejected and invalid codes can push a valid fourth code out.",
      "Replacing couponCode with couponCodes in the CreateOrder schema means existing clients that still send couponCode get a 201 with the field silently stripped and no discount, rather than an error."
     ]
    },
    "greptile": {
     "found": 6,
     "extra": 1,
     "matched": [
      {
       "known_issue": "POST /products/coupons has no authentication or admin check, so any caller can create a 100%-off coupon (or rewrite an existing one) and then redeem it on POST /orders for free goods.",
       "tool_claim": "POST /products/coupons endpoint allows anyone to create or replace coupons without admin authentication, enabling customers to replace existing coupons with 100% discount coupons"
      },
      {
       "known_issue": "stackedTotals deduplicates with new Set(codes) before upper-casing, so ['WELCOME10','welcome10','Welcome10'] survives as three entries and the same coupon is applied three times, contradicting 'duplicates are ignored'.",
       "tool_claim": "stackedTotals removes duplicates before converting codes to uppercase, allowing the same coupon to be applied multiple times with different case variations (e.g., WELCOME10, welcome10, Welcome10 all apply separately)"
      },
      {
       "known_issue": "stackedTotals sums each coupon's percent of the full subtotal with no cap, so discountCents can exceed subtotalCents and totalCents goes negative (e.g. two 60% campaign coupons).",
       "tool_claim": "Coupon creation accepts percentOff values over 100 (like 200), and multiple valid coupons can combine to exceed 100% discount, resulting in negative order totals"
      },
      {
       "known_issue": "POST /products/coupons only checks typeof percentOff === 'number' and never checks minSubtotalCents, so negative or >100 percentages and non-numeric minimums are stored and corrupt order pricing (a negative percent raises totals, >100 makes them negative).",
       "tool_claim": "Coupon creation accepts percentOff values over 100 (like 200), and multiple valid coupons can combine to exceed 100% discount, resulting in negative order totals"
      },
      {
       "known_issue": "createCoupon writes COUPONS[code.toUpperCase()] without checking for an existing entry, so posting 'welcome10' silently overwrites the built-in WELCOME10/BIGBASKET rules for every later order.",
       "tool_claim": "POST /products/coupons endpoint allows anyone to create or replace coupons without admin authentication, enabling customers to replace existing coupons with 100% discount coupons"
      },
      {
       "known_issue": "The returned applied field is the full deduplicated input list, so unknown codes and coupons skipped for minSubtotalCents are stored on the order and reported as applied.",
       "tool_claim": "The applied coupons list includes coupons that were skipped due to failing checks (like minimum subtotal requirements), incorrectly showing unused coupons as applied"
      }
     ],
     "extra_claims": [
      "No tests exist for the new coupon stacking functionality, case-insensitive duplicate handling, three-coupon limit, minimum subtotals, or coupon creation route"
     ],
     "missed": [
      "The three-coupon limit is applied with slice(0, MAX_COUPONS) before codes are validated and the zod schema has no .max(3), so extra codes are silently dropped instead of rejected and invalid codes can push a valid fourth code out.",
      "Replacing couponCode with couponCodes in the CreateOrder schema means existing clients that still send couponCode get a 201 with the field silently stripped and no discount, rather than an error."
     ]
    },
    "codeant": {
     "found": 5,
     "extra": 0,
     "matched": [
      {
       "known_issue": "stackedTotals deduplicates with new Set(codes) before upper-casing, so ['WELCOME10','welcome10','Welcome10'] survives as three entries and the same coupon is applied three times, contradicting 'duplicates are ignored'.",
       "tool_claim": "Deduplication occurs before case normalization, so differently cased versions of the same code survive and can apply the same coupon multiple times"
      },
      {
       "known_issue": "stackedTotals sums each coupon's percent of the full subtotal with no cap, so discountCents can exceed subtotalCents and totalCents goes negative (e.g. two 60% campaign coupons).",
       "tool_claim": "Three eligible 40% coupons discount 120% of the subtotal, producing a negative order total"
      },
      {
       "known_issue": "POST /products/coupons only checks typeof percentOff === 'number' and never checks minSubtotalCents, so negative or >100 percentages and non-numeric minimums are stored and corrupt order pricing (a negative percent raises totals, >100 makes them negative).",
       "tool_claim": "Coupon percentage validation accepts values above 100, allowing discounts that exceed the order subtotal and produce negative totals"
      },
      {
       "known_issue": "The returned applied field is the full deduplicated input list, so unknown codes and coupons skipped for minSubtotalCents are stored on the order and reported as applied.",
       "tool_claim": "Unknown and below-minimum codes are reported as applied, so an order can list a coupon even when it gave no discount"
      },
      {
       "known_issue": "The three-coupon limit is applied with slice(0, MAX_COUPONS) before codes are validated and the zod schema has no .max(3), so extra codes are silently dropped instead of rejected and invalid codes can push a valid fourth code out.",
       "tool_claim": "Schema accepts more than three codes, but pricing silently ignores codes after the third, so oversized requests succeed with some codes unprocessed"
      }
     ],
     "extra_claims": [],
     "missed": [
      "POST /products/coupons has no authentication or admin check, so any caller can create a 100%-off coupon (or rewrite an existing one) and then redeem it on POST /orders for free goods.",
      "createCoupon writes COUPONS[code.toUpperCase()] without checking for an existing entry, so posting 'welcome10' silently overwrites the built-in WELCOME10/BIGBASKET rules for every later order.",
      "Replacing couponCode with couponCodes in the CreateOrder schema means existing clients that still send couponCode get a 201 with the field silently stripped and no discount, rather than an error."
     ]
    }
   }
  },
  {
   "original_pr": 3,
   "tools": {
    "codzee": {
     "found": 7,
     "extra": 1,
     "matched": [
      {
       "known_issue": "PAYMENT_WEBHOOK_SECRET falls back to a hardcoded whsec_... literal, so when the env var is unset anyone who has the source can sign a payment.succeeded event and mark any order paid without paying.",
       "tool_claim": "Hardcoded fallback webhook signing secret - PAYMENT_WEBHOOK_SECRET falls back to a literal whsec_... string when env var is unset, allowing anyone with repo access to forge payment events"
      },
      {
       "known_issue": "The HMAC is computed over JSON.stringify(req.body) instead of the raw request bytes, so any difference in whitespace, key order or escaping makes genuine provider webhooks fail with 401 and orders are never marked paid.",
       "tool_claim": "HMAC computed over re-serialised JSON body - signature checked against JSON.stringify(req.body) instead of original bytes, causing valid webhooks to fail due to serialization differences"
      },
      {
       "known_issue": "payment.succeeded sets order.status = 'paid' regardless of current status, so a late or retried success marks a cancelled/refunded order (whose stock was already released) as paid.",
       "tool_claim": "Succeeded event overrides any order status - payment.succeeded sets order.status to paid regardless of current status, allowing cancelled or shipped orders to regress to paid"
      },
      {
       "known_issue": "payment.refunded sets status to 'cancelled' without calling release(order.lines), so refunded orders keep their stock reserved permanently (and shipped orders are cancelled too).",
       "tool_claim": "Refund cancels order without releasing stock - payment.refunded sets status to cancelled but never calls release(order.lines), causing stock to leak on every refund"
      },
      {
       "known_issue": "The signature covers only the body with no timestamp or event-id check, so a captured signed event can be replayed indefinitely (e.g. replaying payment.succeeded after a refund).",
       "tool_claim": "Signed webhooks can be replayed - no signed timestamp with tolerance and no record of processed event ids allows captured webhooks to be re-sent indefinitely"
      },
      {
       "known_issue": "The signature is compared with != instead of crypto.timingSafeEqual, leaking timing information about the expected HMAC.",
       "tool_claim": "Non-constant-time signature comparison - using != for signature comparison allows timing attacks to recover valid signatures byte by byte"
      },
      {
       "known_issue": "console.log writes the entire req.body payment payload to logs on every event, exposing any customer or payment fields the provider sends.",
       "tool_claim": "Full webhook body written to logs - console.log writes entire req.body which may contain customer and payment details, and allows log injection via request-controlled strings"
      }
     ],
     "extra_claims": [
      "Amount not validated; underpayment silently acknowledged - amountCents is unchecked, missing or insufficient amounts return received:true without updating order, leaving orders stuck in pending"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 5,
     "extra": 0,
     "matched": [
      {
       "known_issue": "PAYMENT_WEBHOOK_SECRET falls back to a hardcoded whsec_... literal, so when the env var is unset anyone who has the source can sign a payment.succeeded event and mark any order paid without paying.",
       "tool_claim": "PAYMENT_WEBHOOK_SECRET uses a source-visible fallback key when environment variable is absent, allowing forged webhook events to mark orders paid or cancelled if attacker knows an existing order ID"
      },
      {
       "known_issue": "The HMAC is computed over JSON.stringify(req.body) instead of the raw request bytes, so any difference in whitespace, key order or escaping makes genuine provider webhooks fail with 401 and orders are never marked paid.",
       "tool_claim": "The verifier signs re-serialized JSON rather than the received bytes, potentially rejecting legitimate deliveries whose encoding changes during parsing"
      },
      {
       "known_issue": "payment.succeeded sets order.status = 'paid' regardless of current status, so a late or retried success marks a cancelled/refunded order (whose stock was already released) as paid.",
       "tool_claim": "The webhook handler checks neither prior order state nor event identity/ordering, allowing delayed or repeated success events to overwrite cancellations, and refunds to overwrite shipped state"
      },
      {
       "known_issue": "payment.refunded sets status to 'cancelled' without calling release(order.lines), so refunded orders keep their stock reserved permanently (and shipped orders are cancelled too).",
       "tool_claim": "The refund path writes the same cancelled status as ordinary cancellation without releasing inventory, leaving inventory effect dependent on which path wrote the status"
      },
      {
       "known_issue": "The signature is compared with != instead of crypto.timingSafeEqual, leaking timing information about the expected HMAC.",
       "tool_claim": "Webhook signature comparison on line 20 uses != instead of crypto.timingSafeEqual, creating a timing side-channel that could leak signature information through response latency"
      }
     ],
     "extra_claims": [],
     "missed": [
      "The signature covers only the body with no timestamp or event-id check, so a captured signed event can be replayed indefinitely (e.g. replaying payment.succeeded after a refund).",
      "console.log writes the entire req.body payment payload to logs on every event, exposing any customer or payment fields the provider sends."
     ]
    },
    "greptile": {
     "found": 3,
     "extra": 0,
     "matched": [
      {
       "known_issue": "PAYMENT_WEBHOOK_SECRET falls back to a hardcoded whsec_... literal, so when the env var is unset anyone who has the source can sign a payment.succeeded event and mark any order paid without paying.",
       "tool_claim": "Missing secret allows forged payments - if PAYMENT_WEBHOOK_SECRET is unset, the public endpoint accepts signatures made with a fallback key committed in code, allowing anyone to send payment.succeeded to mark unpaid orders as paid or payment.refunded to cancel orders"
      },
      {
       "known_issue": "The HMAC is computed over JSON.stringify(req.body) instead of the raw request bytes, so any difference in whitespace, key order or escaping makes genuine provider webhooks fail with 401 and orders are never marked paid.",
       "tool_claim": "Rebuilt JSON rejects valid signatures - using JSON.stringify(req.body) checks a different body than what the provider signed when JSON contains spaces, newlines, or escaped characters, causing valid events to return 401"
      },
      {
       "known_issue": "payment.succeeded sets order.status = 'paid' regardless of current status, so a late or retried success marks a cancelled/refunded order (whose stock was already released) as paid.",
       "tool_claim": "Cancelled orders become paid again - a delayed payment.succeeded event overwrites cancelled status with paid without checking current status or reserving stock, and success events delivered after refunds can reopen orders"
      }
     ],
     "extra_claims": [],
     "missed": [
      "payment.refunded sets status to 'cancelled' without calling release(order.lines), so refunded orders keep their stock reserved permanently (and shipped orders are cancelled too).",
      "The signature covers only the body with no timestamp or event-id check, so a captured signed event can be replayed indefinitely (e.g. replaying payment.succeeded after a refund).",
      "The signature is compared with != instead of crypto.timingSafeEqual, leaking timing information about the expected HMAC.",
      "console.log writes the entire req.body payment payload to logs on every event, exposing any customer or payment fields the provider sends."
     ]
    },
    "codeant": {
     "found": 2,
     "extra": 1,
     "matched": [
      {
       "known_issue": "PAYMENT_WEBHOOK_SECRET falls back to a hardcoded whsec_... literal, so when the env var is unset anyone who has the source can sign a payment.succeeded event and mark any order paid without paying.",
       "tool_claim": "If PAYMENT_WEBHOOK_SECRET is unset, the publicly known fallback value lets anyone forge accepted payment and refund events"
      },
      {
       "known_issue": "payment.succeeded sets order.status = 'paid' regardless of current status, so a late or retried success marks a cancelled/refunded order (whose stock was already released) as paid.",
       "tool_claim": "A delayed payment success for an order already cancelled can mark it paid after cancellation released its stock, leaving a paid order without reserved inventory"
      }
     ],
     "extra_claims": [
      "With no JSON body, JSON.stringify returns undefined, so Hmac.update throws and the request becomes a 500 instead of a signature rejection"
     ],
     "missed": [
      "The HMAC is computed over JSON.stringify(req.body) instead of the raw request bytes, so any difference in whitespace, key order or escaping makes genuine provider webhooks fail with 401 and orders are never marked paid.",
      "payment.refunded sets status to 'cancelled' without calling release(order.lines), so refunded orders keep their stock reserved permanently (and shipped orders are cancelled too).",
      "The signature covers only the body with no timestamp or event-id check, so a captured signed event can be replayed indefinitely (e.g. replaying payment.succeeded after a refund).",
      "The signature is compared with != instead of crypto.timingSafeEqual, leaking timing information about the expected HMAC.",
      "console.log writes the entire req.body payment payload to logs on every event, exposing any customer or payment fields the provider sends."
     ]
    }
   }
  },
  {
   "original_pr": 4,
   "tools": {
    "codzee": {
     "found": 4,
     "extra": 1,
     "matched": [
      {
       "known_issue": "POST /orders already calls reserve(lines), but expressCheckout re-checks stock and decrements products.stock again, so every checkout takes the stock twice (and an order for the last unit fails checkout); a declined hold also leaves the order's original reservation in place, so the 'declined card never takes stock' promise does not hold.",
       "tool_claim": "Stock taken twice for every order - expressCheckout subtracts line.quantity again, but POST /orders already calls reserve(lines) when it creates the order, causing a 2-mug order to take 4 mugs"
      },
      {
       "known_issue": "expressCheckout never checks order.status, so calling it again on a paid (or cancelled/shipped) order places a new hold, takes stock again and captures a second payment, double-charging the customer.",
       "tool_claim": "No order status guard allows double charge - expressCheckout never checks order.status, so calling it on an already paid order holds and captures the card again"
      },
      {
       "known_issue": "The stock check runs before await gateway.hold() and the decrement after it without re-checking, so two concurrent checkouts for the last unit both pass and stock goes negative while both are charged.",
       "tool_claim": "Stock check goes stale across the hold - the stock check at line 19 runs before await gateway.hold, but the decrement at line 25 runs after it with no recheck, allowing another request to take the stock during the hold and driving stock negative"
      },
      {
       "known_issue": "If gateway.capture(holdId) rejects, the stock already decremented is never restored, the hold stays open and the order stays pending, so a retry takes more stock and places another hold.",
       "tool_claim": "Failed capture leaks stock and hold - if gateway.capture(holdId) rejects, the stock decremented at line 25 is never restored, the hold is never released, and the order stays pending"
      }
     ],
     "extra_claims": [
      "Missing product throws a bare TypeError - products.get(line.productId)! has no undefined check, so a line whose product is missing crashes on product.stock with a TypeError instead of UnknownProductError"
     ],
     "missed": [
      "Stock is checked per line rather than per product, so an order with two lines for the same productId can pass each check individually and drive stock below zero."
     ]
    },
    "coderabbit": {
     "found": 5,
     "extra": 1,
     "matched": [
      {
       "known_issue": "POST /orders already calls reserve(lines), but expressCheckout re-checks stock and decrements products.stock again, so every checkout takes the stock twice (and an order for the last unit fails checkout); a declined hold also leaves the order's original reservation in place, so the 'declined card never takes stock' promise does not hold.",
       "tool_claim": "Orders created through POST /orders already have stock taken by reserve(lines), but expressCheckout decrements stock again, causing double stock deduction"
      },
      {
       "known_issue": "expressCheckout never checks order.status, so calling it again on a paid (or cancelled/shipped) order places a new hold, takes stock again and captures a second payment, double-charging the customer.",
       "tool_claim": "expressCheckout does not check order.status, allowing a second call with the same orderId to place another hold, decrement stock, and capture payment - potentially charging the customer twice"
      },
      {
       "known_issue": "The stock check runs before await gateway.hold() and the decrement after it without re-checking, so two concurrent checkouts for the last unit both pass and stock goes negative while both are charged.",
       "tool_claim": "Stock check runs before await gateway.hold(), so two concurrent calls can both pass the check while holds are pending, then both decrement stock without rechecking, potentially resulting in negative stock"
      },
      {
       "known_issue": "If gateway.capture(holdId) rejects, the stock already decremented is never restored, the hold stays open and the order stays pending, so a retry takes more stock and places another hold.",
       "tool_claim": "If hold succeeds but capture rejects, stock remains deducted and order remains pending, with no holdId retained for recovery and no stock restoration"
      },
      {
       "known_issue": "Stock is checked per line rather than per product, so an order with two lines for the same productId can pass each check individually and drive stock below zero.",
       "tool_claim": "Order lines that repeat a productId are checked against the same unreduced stock individually, and stock is decremented once per line, which can result in negative stock values"
      }
     ],
     "extra_claims": [
      "PaymentGateway has no release operation, so if post-hold check fails, the hold remains active on the card with no way to release it"
     ],
     "missed": []
    },
    "greptile": {
     "found": 4,
     "extra": 0,
     "matched": [
      {
       "known_issue": "POST /orders already calls reserve(lines), but expressCheckout re-checks stock and decrements products.stock again, so every checkout takes the stock twice (and an order for the last unit fails checkout); a declined hold also leaves the order's original reservation in place, so the 'declined card never takes stock' promise does not hold.",
       "tool_claim": "Stock is taken twice - POST /orders already calls reserve(lines) before saving the order, and expressCheckout deducts those quantities again, so a successful payment takes stock twice"
      },
      {
       "known_issue": "expressCheckout never checks order.status, so calling it again on a paid (or cancelled/shipped) order places a new hold, takes stock again and captures a second payment, double-charging the customer.",
       "tool_claim": "Orders can be charged again - expressCheckout never checks order.status, allowing it to be called again after success to create another hold, deduct stock again, and capture another payment"
      },
      {
       "known_issue": "The stock check runs before await gateway.hold() and the decrement after it without re-checking, so two concurrent checkouts for the last unit both pass and stock goes negative while both are charged.",
       "tool_claim": "Checkouts sell the same stock - gateway.hold leaves a gap between checking stock and taking it, allowing two checkouts for the same product to both pass with one unit remaining, causing negative stock"
      },
      {
       "known_issue": "If gateway.capture(holdId) rejects, the stock already decremented is never restored, the hold stays open and the order stays pending, so a retry takes more stock and places another hold.",
       "tool_claim": "Failed payment leaves stock missing - if gateway.capture rejects, the stock deduction remains but the order never becomes paid, and cancelling only returns the original reservation leaving checkout's extra deduction behind"
      }
     ],
     "extra_claims": [],
     "missed": [
      "Stock is checked per line rather than per product, so an order with two lines for the same productId can pass each check individually and drive stock below zero."
     ]
    },
    "codeant": {
     "found": 0,
     "extra": 0,
     "matched": [],
     "extra_claims": [],
     "missed": [
      "POST /orders already calls reserve(lines), but expressCheckout re-checks stock and decrements products.stock again, so every checkout takes the stock twice (and an order for the last unit fails checkout); a declined hold also leaves the order's original reservation in place, so the 'declined card never takes stock' promise does not hold.",
      "expressCheckout never checks order.status, so calling it again on a paid (or cancelled/shipped) order places a new hold, takes stock again and captures a second payment, double-charging the customer.",
      "The stock check runs before await gateway.hold() and the decrement after it without re-checking, so two concurrent checkouts for the last unit both pass and stock goes negative while both are charged.",
      "If gateway.capture(holdId) rejects, the stock already decremented is never restored, the hold stays open and the order stays pending, so a retry takes more stock and places another hold.",
      "Stock is checked per line rather than per product, so an order with two lines for the same productId can pass each check individually and drive stock below zero."
     ]
    }
   }
  },
  {
   "original_pr": 5,
   "tools": {
    "codzee": {
     "found": 9,
     "extra": 1,
     "matched": [
      {
       "known_issue": "verifyToken skips signature verification when the token header says alg: 'none', so anyone can forge an unsigned token and read every order from GET /admin/orders.",
       "tool_claim": "alg:none token bypasses signature check - verifyToken skips signature comparison when attacker-controlled header says alg is 'none', allowing unsigned tokens to pass authentication"
      },
      {
       "known_issue": "TOKEN_SECRET falls back to the hardcoded 'dev-admin-secret' when ADMIN_TOKEN_SECRET is unset, so anyone who knows it can sign valid admin tokens.",
       "tool_claim": "Hardcoded fallback token signing secret - TOKEN_SECRET falls back to literal 'dev-admin-secret' when ADMIN_TOKEN_SECRET is unset, allowing anyone who reads the repo to mint valid admin tokens"
      },
      {
       "known_issue": "ADMINS falls back to the password 'changeme' for both ops@ and help@ accounts when ADMIN_PASSWORD/SUPPORT_PASSWORD are unset, so anyone can log in as admin.",
       "tool_claim": "Default admin passwords are 'changeme' - Both ADMINS entries fall back to literal 'changeme' when ADMIN_PASSWORD or SUPPORT_PASSWORD is unset"
      },
      {
       "known_issue": "ADMINS[email] resolves inherited keys, so email '__proto__'/'constructor'/'toString' with no password matches (undefined === undefined) and issueToken returns a valid token.",
       "tool_claim": "Prototype keys log in without a password - ADMINS[email] plain-object lookup allows email 'constructor' or '__proto__' to return inherited truthy value, bypassing password check"
      },
      {
       "known_issue": "verifyToken never compares claims.exp with the current time, so tokens never expire despite the one-working-day TTL.",
       "tool_claim": "Token expiry is never checked - verifyToken returns claims without comparing exp to current time, making tokens valid forever"
      },
      {
       "known_issue": "GET /admin/orders never checks claims.role, so a 'support' token gets the admin-only list of every order.",
       "tool_claim": "Support role can list all orders - GET /orders only checks that verifyToken returned claims but never checks claims.role, allowing support account to access admin-only data"
      },
      {
       "known_issue": "verifyToken calls JSON.parse on the header and payload without try/catch, so a malformed bearer token produces a 500 instead of returning null/401.",
       "tool_claim": "Malformed token returns 500 instead of 401 - verifyToken calls JSON.parse with no try/catch, causing SyntaxError to become 500 response instead of 401"
      },
      {
       "known_issue": "POST /admin/login returns 404 no_such_admin for unknown emails and 401 wrong_password for known ones, letting callers enumerate back-office accounts.",
       "tool_claim": "Login reveals which admin emails exist - /login returns 404 for unknown email and 401 for known one, enabling account enumeration"
      },
      {
       "known_issue": "Admin passwords are kept in plaintext and compared with !==, a non-constant-time comparison that leaks timing.",
       "tool_claim": "Passwords held and compared as plain text - admin.password !== password compares plaintext credentials with short-circuiting comparison that leaks timing"
      }
     ],
     "extra_claims": [
      "Admin login has no rate limit - POST /admin/login has no throttling or lockout, allowing unlimited password guessing"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 7,
     "extra": 0,
     "matched": [
      {
       "known_issue": "verifyToken skips signature verification when the token header says alg: 'none', so anyone can forge an unsigned token and read every order from GET /admin/orders.",
       "tool_claim": "Tokens with header alg:none skip signature verification, allowing unauthenticated callers to forge admin tokens and access /admin/orders"
      },
      {
       "known_issue": "TOKEN_SECRET falls back to the hardcoded 'dev-admin-secret' when ADMIN_TOKEN_SECRET is unset, so anyone who knows it can sign valid admin tokens.",
       "tool_claim": "Public signing-key fallback allows attacker to sign HS256 admin token with 'dev-admin-secret' if ADMIN_TOKEN_SECRET is absent, bypassing authentication"
      },
      {
       "known_issue": "ADMINS falls back to the password 'changeme' for both ops@ and help@ accounts when ADMIN_PASSWORD/SUPPORT_PASSWORD are unset, so anyone can log in as admin.",
       "tool_claim": "Hard-coded password fallback 'changeme' for ADMIN_PASSWORD and SUPPORT_PASSWORD allows login when environment variables are absent"
      },
      {
       "known_issue": "ADMINS[email] resolves inherited keys, so email '__proto__'/'constructor'/'toString' with no password matches (undefined === undefined) and issueToken returns a valid token.",
       "tool_claim": "Prototype pollution vulnerability: POST /admin/login with email='constructor' bypasses authentication due to inherited object properties"
      },
      {
       "known_issue": "verifyToken never compares claims.exp with the current time, so tokens never expire despite the one-working-day TTL.",
       "tool_claim": "Token expiration (exp claim) is not validated, allowing expired tokens to retain access beyond the eight-hour deadline"
      },
      {
       "known_issue": "GET /admin/orders never checks claims.role, so a 'support' token gets the admin-only list of every order.",
       "tool_claim": "Missing role authorization check allows support accounts with role:support to access admin-only /admin/orders endpoint"
      },
      {
       "known_issue": "verifyToken calls JSON.parse on the header and payload without try/catch, so a malformed bearer token produces a 500 instead of returning null/401.",
       "tool_claim": "JSON.parse throws before signature verification for malformed token JSON (e.g., Authorization: Bearer eA.e30.x), causing server error instead of 401 response"
      }
     ],
     "extra_claims": [],
     "missed": [
      "POST /admin/login returns 404 no_such_admin for unknown emails and 401 wrong_password for known ones, letting callers enumerate back-office accounts.",
      "Admin passwords are kept in plaintext and compared with !==, a non-constant-time comparison that leaks timing."
     ]
    },
    "greptile": {
     "found": 7,
     "extra": 1,
     "matched": [
      {
       "known_issue": "verifyToken skips signature verification when the token header says alg: 'none', so anyone can forge an unsigned token and read every order from GET /admin/orders.",
       "tool_claim": "verifyToken skips signature check when token header says alg: 'none', allowing anyone to send arbitrary payload with no signature to GET /admin/orders and receive every order"
      },
      {
       "known_issue": "TOKEN_SECRET falls back to the hardcoded 'dev-admin-secret' when ADMIN_TOKEN_SECRET is unset, so anyone who knows it can sign valid admin tokens.",
       "tool_claim": "If ADMIN_TOKEN_SECRET is missing, server signs and accepts tokens using public fallback value 'dev-admin-secret', allowing anyone to forge admin tokens"
      },
      {
       "known_issue": "ADMINS falls back to the password 'changeme' for both ops@ and help@ accounts when ADMIN_PASSWORD/SUPPORT_PASSWORD are unset, so anyone can log in as admin.",
       "tool_claim": "If ADMIN_PASSWORD or SUPPORT_PASSWORD is missing, accounts stay enabled with default password 'changeme', enabling unauthorized logins"
      },
      {
       "known_issue": "ADMINS[email] resolves inherited keys, so email '__proto__'/'constructor'/'toString' with no password matches (undefined === undefined) and issueToken returns a valid token.",
       "tool_claim": "ADMINS[email] returns inherited properties, allowing login with {\"email\":\"__proto__\"} and no password to pass authentication and issue a signed token"
      },
      {
       "known_issue": "verifyToken never compares claims.exp with the current time, so tokens never expire despite the one-working-day TTL.",
       "tool_claim": "verifyToken never checks exp claim, so tokens remain valid indefinitely after their eight-hour lifetime"
      },
      {
       "known_issue": "GET /admin/orders never checks claims.role, so a 'support' token gets the admin-only list of every order.",
       "tool_claim": "Admin-only orders route checks if claims exist but never requires claims.role === 'admin', allowing support users to read every order"
      },
      {
       "known_issue": "verifyToken calls JSON.parse on the header and payload without try/catch, so a malformed bearer token produces a 500 instead of returning null/401.",
       "tool_claim": "Malformed tokens cause JSON.parse to throw instead of returning null, resulting in server errors instead of 401 responses"
      }
     ],
     "extra_claims": [
      "POST /admin/login allows unlimited password guesses without delay, attempt limit, or temporary block"
     ],
     "missed": [
      "POST /admin/login returns 404 no_such_admin for unknown emails and 401 wrong_password for known ones, letting callers enumerate back-office accounts.",
      "Admin passwords are kept in plaintext and compared with !==, a non-constant-time comparison that leaks timing."
     ]
    },
    "codeant": {
     "found": 7,
     "extra": 0,
     "matched": [
      {
       "known_issue": "verifyToken skips signature verification when the token header says alg: 'none', so anyone can forge an unsigned token and read every order from GET /admin/orders.",
       "tool_claim": "alg: \"none\" skips signature verification, allowing attackers to supply unsigned claims that /admin/orders accepts as signed in"
      },
      {
       "known_issue": "TOKEN_SECRET falls back to the hardcoded 'dev-admin-secret' when ADMIN_TOKEN_SECRET is unset, so anyone who knows it can sign valid admin tokens.",
       "tool_claim": "When ADMIN_TOKEN_SECRET is unset, the public fallback lets anyone who knows the source default sign tokens and access protected admin data"
      },
      {
       "known_issue": "ADMINS falls back to the password 'changeme' for both ops@ and help@ accounts when ADMIN_PASSWORD/SUPPORT_PASSWORD are unset, so anyone can log in as admin.",
       "tool_claim": "When either password variable is unset, the corresponding account accepts the public changeme password, exposing admin or support login"
      },
      {
       "known_issue": "ADMINS[email] resolves inherited keys, so email '__proto__'/'constructor'/'toString' with no password matches (undefined === undefined) and issueToken returns a valid token.",
       "tool_claim": "ADMINS inherits keys such as constructor; requesting that email without a password yields an inherited function with an undefined password, so login issues an accepted token"
      },
      {
       "known_issue": "verifyToken never compares claims.exp with the current time, so tokens never expire despite the one-working-day TTL.",
       "tool_claim": "exp is never compared with the current time before claims are returned, so issued tokens remain valid after their advertised eight-hour lifetime"
      },
      {
       "known_issue": "GET /admin/orders never checks claims.role, so a 'support' token gets the admin-only list of every order.",
       "tool_claim": "A support token passes the presence-only check and receives every order, so the endpoint's admin-only access restriction is not enforced"
      },
      {
       "known_issue": "verifyToken calls JSON.parse on the header and payload without try/catch, so a malformed bearer token produces a 500 instead of returning null/401.",
       "tool_claim": "A malformed encoded header makes JSON.parse throw through /admin/orders, producing an HTTP 500 instead of the documented null result and 401 response"
      }
     ],
     "extra_claims": [],
     "missed": [
      "POST /admin/login returns 404 no_such_admin for unknown emails and 401 wrong_password for known ones, letting callers enumerate back-office accounts.",
      "Admin passwords are kept in plaintext and compared with !==, a non-constant-time comparison that leaks timing."
     ]
    }
   }
  },
  {
   "original_pr": 6,
   "tools": {
    "codzee": {
     "found": 9,
     "extra": 1,
     "matched": [
      {
       "known_issue": "newToken() builds the reset token from Math.random() with only ~8 base-36 characters, a non-cryptographic and low-entropy secret that can be predicted or brute-forced to take over accounts.",
       "tool_claim": "Reset token generated using Math.random is guessable and non-cryptographic, allowing attackers to predict tokens and take over accounts"
      },
      {
       "known_issue": "The reset link is passed to sendEmail, which console.logs the full body, so live reset tokens are written to application logs and anyone with log access can reset any password.",
       "tool_claim": "Reset link is only logged to console and no actual email is sent, yet the endpoint returns success"
      },
      {
       "known_issue": "/confirm never checks reset.createdAt, so reset tokens never expire.",
       "tool_claim": "Reset tokens never expire - createdAt is stored but never checked against the clock, allowing old tokens to remain valid indefinitely"
      },
      {
       "known_issue": "/confirm never deletes the token after a successful reset, so a used link can be reused to change the password again.",
       "tool_claim": "Reset token can be replayed after use - token is never deleted from resets map after successful password reset"
      },
      {
       "known_issue": "/request returns 404 no_account_for_email for unknown addresses and 200 for known ones, letting anyone enumerate customer emails.",
       "tool_claim": "Reset request reveals registered emails by returning different responses (404 vs 200) for unknown vs known email addresses"
      },
      {
       "known_issue": "The new password is written to a module-private passwords Map that nothing reads, so a successful reset does not change any credential used for login.",
       "tool_claim": "Confirm endpoint reports success but password is written to a module-local map that nothing reads, so the password reset never actually takes effect"
      },
      {
       "known_issue": "passwords.set stores the submitted password in plaintext instead of a salted hash.",
       "tool_claim": "New password is stored as plain text instead of being hashed with scrypt, bcrypt, or argon2"
      },
      {
       "known_issue": "sendEmail only writes to the console, so no email is ever sent even though the endpoint replies { sent: true }.",
       "tool_claim": "Reset link is only logged to console and no actual email is sent, yet the endpoint returns success"
      },
      {
       "known_issue": "Each /request for a known email adds a new entry to resets with no rate limit, cleanup or invalidation of earlier tokens, so the map grows without bound.",
       "tool_claim": "Reset endpoints have no rate limiting, allowing mail-bombing, token brute-forcing, and memory exhaustion through unbounded token map growth"
      }
     ],
     "extra_claims": [
      "Email lookup is case-sensitive - no trimming or lowercasing before comparison causes valid customers to get no_account_for_email error"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 7,
     "extra": 0,
     "matched": [
      {
       "known_issue": "newToken() builds the reset token from Math.random() with only ~8 base-36 characters, a non-cryptographic and low-entropy secret that can be predicted or brute-forced to take over accounts.",
       "tool_claim": "Math.random() is not cryptographically secure for generating reset tokens - use a cryptographic random source with sufficient output length"
      },
      {
       "known_issue": "The reset link is passed to sendEmail, which console.logs the full body, so live reset tokens are written to application logs and anyone with log access can reset any password.",
       "tool_claim": "Reset token is logged to stdout in the email body, exposing sensitive data to anyone with log access"
      },
      {
       "known_issue": "/confirm never checks reset.createdAt, so reset tokens never expire.",
       "tool_claim": "Reset tokens have no expiration check - createdAt is recorded but never validated, allowing old tokens to remain valid indefinitely"
      },
      {
       "known_issue": "/confirm never deletes the token after a successful reset, so a used link can be reused to change the password again.",
       "tool_claim": "Reset tokens are not consumed after successful password update, allowing the same token to be reused multiple times"
      },
      {
       "known_issue": "/request returns 404 no_account_for_email for unknown addresses and 200 for known ones, letting anyone enumerate customer emails.",
       "tool_claim": "Different responses for registered vs unknown emails (404/no_account_for_email vs {sent: true}) exposes account membership information"
      },
      {
       "known_issue": "The new password is written to a module-private passwords Map that nothing reads, so a successful reset does not change any credential used for login.",
       "tool_claim": "Password update only writes to module-private passwords Map which is never read or exported, so authentication code cannot use the new password"
      },
      {
       "known_issue": "sendEmail only writes to the console, so no email is ever sent even though the endpoint replies { sent: true }.",
       "tool_claim": "sendEmail only calls console.log instead of actually sending email through an email provider, so customers never receive reset links"
      }
     ],
     "extra_claims": [],
     "missed": [
      "passwords.set stores the submitted password in plaintext instead of a salted hash.",
      "Each /request for a known email adds a new entry to resets with no rate limit, cleanup or invalidation of earlier tokens, so the map grows without bound."
     ]
    },
    "greptile": {
     "found": 8,
     "extra": 1,
     "matched": [
      {
       "known_issue": "newToken() builds the reset token from Math.random() with only ~8 base-36 characters, a non-cryptographic and low-entropy secret that can be predicted or brute-forced to take over accounts.",
       "tool_claim": "newToken uses Math.random with only ~41 bits of entropy instead of cryptographic randomness like randomBytes(32)"
      },
      {
       "known_issue": "The reset link is passed to sendEmail, which console.logs the full body, so live reset tokens are written to application logs and anyone with log access can reset any password.",
       "tool_claim": "sendEmail logs the complete reset link including token to application logs, exposing password reset secrets"
      },
      {
       "known_issue": "/confirm never checks reset.createdAt, so reset tokens never expire.",
       "tool_claim": "/confirm never checks createdAt or removes reset entries after success, allowing old reset links to remain usable indefinitely"
      },
      {
       "known_issue": "/confirm never deletes the token after a successful reset, so a used link can be reused to change the password again.",
       "tool_claim": "/confirm never checks createdAt or removes reset entries after success, allowing old reset links to remain usable indefinitely"
      },
      {
       "known_issue": "/request returns 404 no_account_for_email for unknown addresses and 200 for known ones, letting anyone enumerate customer emails.",
       "tool_claim": "/request returns different responses (404 vs success) for unknown vs known emails, allowing enumeration of customer accounts"
      },
      {
       "known_issue": "The new password is written to a module-private passwords Map that nothing reads, so a successful reset does not change any credential used for login.",
       "tool_claim": "/confirm writes password to a private passwords map that nothing reads or exports, failing to update actual customer credentials"
      },
      {
       "known_issue": "passwords.set stores the submitted password in plaintext instead of a salted hash.",
       "tool_claim": "passwords.set stores raw unhashed passwords in memory for process lifetime, risking exposure in memory dumps"
      },
      {
       "known_issue": "sendEmail only writes to the console, so no email is ever sent even though the endpoint replies { sent: true }.",
       "tool_claim": "sendEmail only writes to console and never actually sends emails, so reset links never reach customers despite returning success"
      }
     ],
     "extra_claims": [
      "Reset link hardcodes placeholder URL https://shopflow.example/reset instead of using configured frontend address"
     ],
     "missed": [
      "Each /request for a known email adds a new entry to resets with no rate limit, cleanup or invalidation of earlier tokens, so the map grows without bound."
     ]
    },
    "codeant": {
     "found": 0,
     "extra": 0,
     "matched": [],
     "extra_claims": [],
     "missed": [
      "newToken() builds the reset token from Math.random() with only ~8 base-36 characters, a non-cryptographic and low-entropy secret that can be predicted or brute-forced to take over accounts.",
      "The reset link is passed to sendEmail, which console.logs the full body, so live reset tokens are written to application logs and anyone with log access can reset any password.",
      "/confirm never checks reset.createdAt, so reset tokens never expire.",
      "/confirm never deletes the token after a successful reset, so a used link can be reused to change the password again.",
      "/request returns 404 no_account_for_email for unknown addresses and 200 for known ones, letting anyone enumerate customer emails.",
      "The new password is written to a module-private passwords Map that nothing reads, so a successful reset does not change any credential used for login.",
      "passwords.set stores the submitted password in plaintext instead of a salted hash.",
      "sendEmail only writes to the console, so no email is ever sent even though the endpoint replies { sent: true }.",
      "Each /request for a known email adds a new entry to resets with no rate limit, cleanup or invalidation of earlier tokens, so the map grows without bound."
     ]
    }
   }
  },
  {
   "original_pr": 7,
   "tools": {
    "codzee": {
     "found": 9,
     "extra": 1,
     "matched": [
      {
       "known_issue": "writeFile(path.join(IMAGE_DIR, feed.imageName)) uses a file name from the remote feed, so '../../src/app.ts' escapes public/images and overwrites any file the process can write with attacker-chosen bytes.",
       "tool_claim": "Remote imageName writes files anywhere on disk - path.join(IMAGE_DIR, feed.imageName) uses unchecked name from fetched feed, allowing path traversal like ../../dist/server.js to escape public/images and overwrite arbitrary files"
      },
      {
       "known_issue": "fetch(feedUrl) and fetch(feed.imageUrl) request arbitrary caller/feed-supplied URLs with no scheme or host allowlist, enabling SSRF to loopback, metadata and internal services.",
       "tool_claim": "User-supplied URLs fetched server-side (SSRF) - fetch(feedUrl) and fetch(feed.imageUrl) have no scheme or host check, allowing access to cloud metadata endpoints, localhost services, and internal hosts"
      },
      {
       "known_issue": "/imports is mounted with no authentication or role check although it is meant for merchandising, so anyone can create products and trigger the server-side fetches and file writes.",
       "tool_claim": "Import endpoint has no authentication - importRoutes.post('/products') is mounted with no auth or role check, allowing anonymous callers to create products and trigger outbound fetches"
      },
      {
       "known_issue": "The async handler has no try/catch and Express 4 does not forward rejected promises, so a failed fetch, invalid JSON or failed write leaves the request hanging and produces an unhandled rejection that can crash the process.",
       "tool_claim": "Failed fetch hangs request or crashes process - async handler on Express 4 doesn't catch rejected promises, causing unhandled rejections that can terminate the process on Node 15+"
      },
      {
       "known_issue": "Feed fields are stored unvalidated: a missing or string price gives priceCents NaN, negative prices are accepted, name can be undefined and stock can be negative or a string, all of which flow into order totals.",
       "tool_claim": "Unvalidated feed data stored as product - feed.name, feed.price, feed.stock and feed.category are stored unchecked, allowing NaN or negative prices that flow into checkout calculations"
      },
      {
       "known_issue": "products.set runs before the image download and write, so if the image step fails the product stays in the catalogue half-imported and a retry creates a duplicate.",
       "tool_claim": "Product saved before image download can fail - products.set runs before image fetch and writeFile, leaving partial products in catalogue if image step fails"
      },
      {
       "known_issue": "Both downloads are buffered fully into memory (arrayBuffer/json) with no size limit or timeout, so a large supplier response can exhaust server memory.",
       "tool_claim": "Unbounded image download held in memory - fetch(feed.imageUrl) with arrayBuffer() has no timeout, status check or size cap, allowing memory exhaustion from large or never-ending responses"
      },
      {
       "known_issue": "Neither download checks response.ok, so a 404/500 error page is saved as the product image and the import still returns 201.",
       "tool_claim": "Unbounded image download held in memory - fetch(feed.imageUrl) with arrayBuffer() has no timeout, status check or size cap, allowing memory exhaustion from large or never-ending responses"
      },
      {
       "known_issue": "The image fetch never checks response.ok, so an HTTP error page from the supplier is saved as the product image and the import still returns 201.",
       "tool_claim": "Unbounded image download held in memory - fetch(feed.imageUrl) with arrayBuffer() has no timeout, status check or size cap, allowing memory exhaustion from large or never-ending responses"
      }
     ],
     "extra_claims": [
      "Saved image is never served or linked - image is written to public/images but app.ts has no express.static and Product has no image field, making the feature non-functional"
     ],
     "missed": [
      "public/images does not exist in the repo and writeFile does not create directories, so any import with an image fails with ENOENT."
     ]
    },
    "coderabbit": {
     "found": 6,
     "extra": 0,
     "matched": [
      {
       "known_issue": "writeFile(path.join(IMAGE_DIR, feed.imageName)) uses a file name from the remote feed, so '../../src/app.ts' escapes public/images and overwrites any file the process can write with attacker-chosen bytes.",
       "tool_claim": "Path traversal vulnerability: A controlled feed can set imageName to ../../package.json and supply arbitrary bytes. path.join() normalizes this destination outside public/images, allowing file overwrites where the process has write access"
      },
      {
       "known_issue": "fetch(feedUrl) and fetch(feed.imageUrl) request arbitrary caller/feed-supplied URLs with no scheme or host allowlist, enabling SSRF to loopback, metadata and internal services.",
       "tool_claim": "SSRF vulnerability: A caller can submit internal URLs like http://127.0.0.1:8080/health as feedUrl, and the server will contact that internal service. A controlled feed can do the same through imageUrl. Default redirect following also permits a public URL to redirect to an internal destination"
      },
      {
       "known_issue": "The async handler has no try/catch and Express 4 does not forward rejected promises, so a failed fetch, invalid JSON or failed write leaves the request hanging and produces an unhandled rejection that can crash the process.",
       "tool_claim": "If a supplier request fails, JSON parsing fails, or an image write fails, the callback rejects without sending an error response. Express 4 does not automatically forward rejected async handlers to its error handler, leaving the rejection unhandled"
      },
      {
       "known_issue": "Feed fields are stored unvalidated: a missing or string price gives priceCents NaN, negative prices are accepted, name can be undefined and stock can be negative or a string, all of which flow into order totals.",
       "tool_claim": "No runtime validation of imported feed fields. A feed without a numeric price stores priceCents as NaN, breaking checkout totals. A feed with non-numeric stock stores NaN after first reservation, causing stock check to never reject orders. A feed without name stores a product with no name"
      },
      {
       "known_issue": "products.set runs before the image download and write, so if the image step fails the product stays in the catalogue half-imported and a retry creates a duplicate.",
       "tool_claim": "Product is inserted before image processing succeeds. If image request or file write fails, the product remains in products but caller receives no 201. A retry creates another product with a new id"
      },
      {
       "known_issue": "Both downloads are buffered fully into memory (arrayBuffer/json) with no size limit or timeout, so a large supplier response can exhaust server memory.",
       "tool_claim": "Denial of Service: A caller-controlled supplier can return a multi-gigabyte feed or image. json() and arrayBuffer() consume the complete response body, permitting memory exhaustion. The 100kb Express limit only applies to incoming requests, not remote responses"
      }
     ],
     "extra_claims": [],
     "missed": [
      "/imports is mounted with no authentication or role check although it is meant for merchandising, so anyone can create products and trigger the server-side fetches and file writes.",
      "public/images does not exist in the repo and writeFile does not create directories, so any import with an image fails with ENOENT.",
      "Neither download checks response.ok, so a 404/500 error page is saved as the product image and the import still returns 201.",
      "The image fetch never checks response.ok, so an HTTP error page from the supplier is saved as the product image and the import still returns 201."
     ]
    },
    "greptile": {
     "found": 6,
     "extra": 0,
     "matched": [
      {
       "known_issue": "writeFile(path.join(IMAGE_DIR, feed.imageName)) uses a file name from the remote feed, so '../../src/app.ts' escapes public/images and overwrites any file the process can write with attacker-chosen bytes.",
       "tool_claim": "feed.imageName can escape public/images directory using path traversal (e.g., ../../package.json), allowing overwrite of application files"
      },
      {
       "known_issue": "fetch(feedUrl) and fetch(feed.imageUrl) request arbitrary caller/feed-supplied URLs with no scheme or host allowlist, enabling SSRF to loopback, metadata and internal services.",
       "tool_claim": "feedUrl and feed.imageUrl reach fetch without destination checks, allowing callers to make requests to loopback or private-network services from the server's network (SSRF vulnerability)"
      },
      {
       "known_issue": "The async handler has no try/catch and Express 4 does not forward rejected promises, so a failed fetch, invalid JSON or failed write leaves the request hanging and produces an unhandled rejection that can crash the process.",
       "tool_claim": "Async handler has no error wrapper or try/catch in Express 4, causing unhandled rejections that can terminate the API when feed is unreachable or returns non-JSON"
      },
      {
       "known_issue": "Feed fields are stored unvalidated: a missing or string price gives priceCents NaN, negative prices are accepted, name can be undefined and stock can be negative or a string, all of which flow into order totals.",
       "tool_claim": "Feed fields are stored without type or value validation, allowing invalid products with NaN prices to be created and ordered"
      },
      {
       "known_issue": "public/images does not exist in the repo and writeFile does not create directories, so any import with an image fails with ENOENT.",
       "tool_claim": "public/images directory does not exist in fresh checkout and is not created by startup or route, causing writeFile to fail with ENOENT"
      },
      {
       "known_issue": "Both downloads are buffered fully into memory (arrayBuffer/json) with no size limit or timeout, so a large supplier response can exhaust server memory.",
       "tool_claim": "Route reads entire remote image into memory without size limit, allowing large downloads to exhaust server memory"
      }
     ],
     "extra_claims": [],
     "missed": [
      "/imports is mounted with no authentication or role check although it is meant for merchandising, so anyone can create products and trigger the server-side fetches and file writes.",
      "products.set runs before the image download and write, so if the image step fails the product stays in the catalogue half-imported and a retry creates a duplicate.",
      "Neither download checks response.ok, so a 404/500 error page is saved as the product image and the import still returns 201.",
      "The image fetch never checks response.ok, so an HTTP error page from the supplier is saved as the product image and the import still returns 201."
     ]
    },
    "codeant": {
     "found": 0,
     "extra": 0,
     "matched": [],
     "extra_claims": [],
     "missed": [
      "writeFile(path.join(IMAGE_DIR, feed.imageName)) uses a file name from the remote feed, so '../../src/app.ts' escapes public/images and overwrites any file the process can write with attacker-chosen bytes.",
      "fetch(feedUrl) and fetch(feed.imageUrl) request arbitrary caller/feed-supplied URLs with no scheme or host allowlist, enabling SSRF to loopback, metadata and internal services.",
      "/imports is mounted with no authentication or role check although it is meant for merchandising, so anyone can create products and trigger the server-side fetches and file writes.",
      "The async handler has no try/catch and Express 4 does not forward rejected promises, so a failed fetch, invalid JSON or failed write leaves the request hanging and produces an unhandled rejection that can crash the process.",
      "Feed fields are stored unvalidated: a missing or string price gives priceCents NaN, negative prices are accepted, name can be undefined and stock can be negative or a string, all of which flow into order totals.",
      "products.set runs before the image download and write, so if the image step fails the product stays in the catalogue half-imported and a retry creates a duplicate.",
      "public/images does not exist in the repo and writeFile does not create directories, so any import with an image fails with ENOENT.",
      "Both downloads are buffered fully into memory (arrayBuffer/json) with no size limit or timeout, so a large supplier response can exhaust server memory.",
      "Neither download checks response.ok, so a 404/500 error page is saved as the product image and the import still returns 201.",
      "The image fetch never checks response.ok, so an HTTP error page from the supplier is saved as the product image and the import still returns 201."
     ]
    }
   }
  },
  {
   "original_pr": 8,
   "tools": {
    "codzee": {
     "found": 5,
     "extra": 1,
     "matched": [
      {
       "known_issue": "GET /partners/orders never restricts results to partner.customerIds, so any valid key can read any customer's orders by passing customerId, or every order by omitting it.",
       "tool_claim": "The /orders handler never checks partner.customerIds, allowing partners to read all customers' orders or access customers outside their authorized list"
      },
      {
       "known_issue": "POST /partners has no authentication although it is meant for the admin tool, so anyone can mint a working partner API key with arbitrary customerIds.",
       "tool_claim": "POST /partners has no authentication or role check, allowing any anonymous caller to create a partner with arbitrary customerIds and receive a working apiKey"
      },
      {
       "known_issue": "console.log writes the full newly issued apiKey to logs, so anyone with log access can act as that partner.",
       "tool_claim": "API key is written to logs in plaintext via console.log, exposing credentials to anyone with log access"
      },
      {
       "known_issue": "partners.set(name, ...) keys partners by an unvalidated name, so re-posting an existing name silently replaces that partner's key and customers (locking out the real partner) and a missing name is stored as 'undefined'.",
       "tool_claim": "partners map is keyed by caller-supplied name, so a second POST /partners with an existing name overwrites that partner and invalidates the old key"
      },
      {
       "known_issue": "partnerFor compares API keys with == in a linear scan, a non-constant-time comparison.",
       "tool_claim": "API key compared with non-constant-time == operator in partnerFor function, creating potential timing attack vulnerability"
      }
     ],
     "extra_claims": [
      "Repeated calls to POST /partners grow the in-memory partners map without bound"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 4,
     "extra": 0,
     "matched": [
      {
       "known_issue": "GET /partners/orders never restricts results to partner.customerIds, so any valid key can read any customer's orders by passing customerId, or every order by omitting it.",
       "tool_claim": "GET /partners/orders does not restrict results to the partner's assigned customerIds, allowing a partner to request orders for any customerId including those not assigned to them (IDOR - CWE-862)"
      },
      {
       "known_issue": "POST /partners has no authentication although it is meant for the admin tool, so anyone can mint a working partner API key with arbitrary customerIds.",
       "tool_claim": "POST /partners endpoint has no authentication or role check, allowing any caller to register as a partner and obtain a valid API key (Authorization Bypass - CWE-862)"
      },
      {
       "known_issue": "console.log writes the full newly issued apiKey to logs, so anyone with log access can act as that partner.",
       "tool_claim": "API key is logged to stdout during partner registration, exposing sensitive credentials to anyone with log access (Sensitive Data Exposure - CWE-532)"
      },
      {
       "known_issue": "partners.set(name, ...) keys partners by an unvalidated name, so re-posting an existing name silently replaces that partner's key and customers (locking out the real partner) and a missing name is stored as 'undefined'.",
       "tool_claim": "Registration uses caller-supplied name as credential record key, allowing re-registration of the same name to replace the prior key without ownership check"
      }
     ],
     "extra_claims": [],
     "missed": [
      "partnerFor compares API keys with == in a linear scan, a non-constant-time comparison."
     ]
    },
    "greptile": {
     "found": 4,
     "extra": 0,
     "matched": [
      {
       "known_issue": "GET /partners/orders never restricts results to partner.customerIds, so any valid key can read any customer's orders by passing customerId, or every order by omitting it.",
       "tool_claim": "Partners can read all orders regardless of their assigned customers - the filter uses only the caller's customerId query parameter and never checks partner.customerIds, allowing access to all orders when query is omitted"
      },
      {
       "known_issue": "POST /partners has no authentication although it is meant for the admin tool, so anyone can mint a working partner API key with arbitrary customerIds.",
       "tool_claim": "Anyone can call POST /partners and receive a working API key without admin authentication - the createApp mounts this route without an admin check, allowing unauthorized partner creation and customer assignment"
      },
      {
       "known_issue": "console.log writes the full newly issued apiKey to logs, so anyone with log access can act as that partner.",
       "tool_claim": "Partner creation logs the full API key to application logs, exposing working credentials to anyone with log access"
      },
      {
       "known_issue": "partners.set(name, ...) keys partners by an unvalidated name, so re-posting an existing name silently replaces that partner's key and customers (locking out the real partner) and a missing name is stored as 'undefined'.",
       "tool_claim": "Creating a partner with a duplicate name silently replaces the existing partner and its API key, causing the original partner's key to return 401 without explicit key rotation"
      }
     ],
     "extra_claims": [],
     "missed": [
      "partnerFor compares API keys with == in a linear scan, a non-constant-time comparison."
     ]
    },
    "codeant": {
     "found": 2,
     "extra": 0,
     "matched": [
      {
       "known_issue": "GET /partners/orders never restricts results to partner.customerIds, so any valid key can read any customer's orders by passing customerId, or every order by omitting it.",
       "tool_claim": "The matched partner's customerIds are never checked, so any valid API key can retrieve every order or another customer's order by omitting or choosing customerId"
      },
      {
       "known_issue": "console.log writes the full newly issued apiKey to logs, so anyone with log access can act as that partner.",
       "tool_claim": "The generated API key is logged, which exposes a bearer credential to anyone with access to service logs, giving them the same order-reading access as the partner"
      }
     ],
     "extra_claims": [],
     "missed": [
      "POST /partners has no authentication although it is meant for the admin tool, so anyone can mint a working partner API key with arbitrary customerIds.",
      "partners.set(name, ...) keys partners by an unvalidated name, so re-posting an existing name silently replaces that partner's key and customers (locking out the real partner) and a missing name is stored as 'undefined'.",
      "partnerFor compares API keys with == in a linear scan, a non-constant-time comparison."
     ]
    }
   }
  },
  {
   "original_pr": 9,
   "tools": {
    "codzee": {
     "found": 5,
     "extra": 2,
     "matched": [
      {
       "known_issue": "app.use(cors) is registered after the /health, /products and /orders routes, which end the response, so those responses never get CORS headers and the storefront cannot call the API.",
       "tool_claim": "CORS middleware is registered after routes (/health, /products, /orders), so it never runs for real routes and browser requests are blocked"
      },
      {
       "known_issue": "cors() reflects any request Origin into Access-Control-Allow-Origin together with Allow-Credentials: true, so any website can make credentialed requests and read the responses; there is no storefront/preview allowlist.",
       "tool_claim": "CORS middleware echoes any Origin header with Access-Control-Allow-Origin and Allow-Credentials: true without an allowlist, allowing any website to make credentialed calls and read responses"
      },
      {
       "known_issue": "startSession stores the raw customerId in sf_session unsigned and sessionCustomer returns it as the signed-in customer, so a client can set sf_session=cus_00001 and impersonate any customer once these helpers are used.",
       "tool_claim": "Session cookie stores raw customerId unsigned and unencrypted, and since IDs are sequential, anyone can set the cookie manually to impersonate any customer"
      },
      {
       "known_issue": "The sf_session cookie is set for 30 days without httpOnly or secure, so it is readable by page scripts and can be sent over plain HTTP.",
       "tool_claim": "Session cookie lacks HttpOnly, Secure, and SameSite flags, making it readable by page scripts, sent over plain HTTP, and vulnerable to CSRF"
      },
      {
       "known_issue": "The /sf_session=([^;]+)/ regex is not anchored to a cookie boundary, so a cookie such as old_sf_session=... is matched instead of (or in place of) sf_session.",
       "tool_claim": "Cookie regex /sf_session=([^;]+)/ has no boundary anchor, so cookies like xsf_session or foo_sf_session can match and override the real session cookie"
      }
     ],
     "extra_claims": [
      "startSession and sessionCustomer helpers are never called anywhere, no login route exists, so the session feature described in the PR is not implemented",
      "Reflected origin in CORS is sent without Vary: Origin header, causing potential cache issues where wrong CORS headers are served to different origins"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 3,
     "extra": 1,
     "matched": [
      {
       "known_issue": "app.use(cors) is registered after the /health, /products and /orders routes, which end the response, so those responses never get CORS headers and the storefront cannot call the API.",
       "tool_claim": "CORS middleware is registered after product and order routes, so GET /products and other routes respond without CORS headers before the middleware runs, preventing browsers from reading responses"
      },
      {
       "known_issue": "startSession stores the raw customerId in sf_session unsigned and sessionCustomer returns it as the signed-in customer, so a client can set sf_session=cus_00001 and impersonate any customer once these helpers are used.",
       "tool_claim": "sessionCustomer returns raw cookie value as customer identity without any authenticity verification, allowing clients to impersonate any customer by setting sf_session to any customer ID"
      },
      {
       "known_issue": "The /sf_session=([^;]+)/ regex is not anchored to a cookie boundary, so a cookie such as old_sf_session=... is matched instead of (or in place of) sf_session.",
       "tool_claim": "Cookie parsing regex for sf_session can match partial cookie names like old_sf_session, returning incorrect session values"
      }
     ],
     "extra_claims": [
      "Permissive preflights can let untrusted browser origins reach order creation and cancellation handlers that do not verify caller ownership, allowing mutations to orders and inventory before the browser rejects access to the response"
     ],
     "missed": [
      "cors() reflects any request Origin into Access-Control-Allow-Origin together with Allow-Credentials: true, so any website can make credentialed requests and read the responses; there is no storefront/preview allowlist.",
      "The sf_session cookie is set for 30 days without httpOnly or secure, so it is readable by page scripts and can be sent over plain HTTP."
     ]
    },
    "greptile": {
     "found": 4,
     "extra": 0,
     "matched": [
      {
       "known_issue": "app.use(cors) is registered after the /health, /products and /orders routes, which end the response, so those responses never get CORS headers and the storefront cannot call the API.",
       "tool_claim": "CORS middleware runs after routes that send API responses, so browser requests to endpoints like GET /products never receive CORS headers - cors should be registered before routes and JSON parser"
      },
      {
       "known_issue": "cors() reflects any request Origin into Access-Control-Allow-Origin together with Allow-Credentials: true, so any website can make credentialed requests and read the responses; there is no storefront/preview allowlist.",
       "tool_claim": "CORS configuration accepts every supplied origin while allowing cookies, which will allow unrelated websites access once middleware order is fixed - should check an explicit list of allowed origins before returning credentialed CORS headers"
      },
      {
       "known_issue": "startSession stores the raw customerId in sf_session unsigned and sessionCustomer returns it as the signed-in customer, so a client can set sf_session=cus_00001 and impersonate any customer once these helpers are used.",
       "tool_claim": "sessionCustomer returns a customer ID supplied entirely by the client with no signature or server-side session record, allowing session identity to be invented - should use unpredictable server-side session ID or verify a signed value"
      },
      {
       "known_issue": "The sf_session cookie is set for 30 days without httpOnly or secure, so it is readable by page scripts and can be sent over plain HTTP.",
       "tool_claim": "startSession creates a month-long session cookie without httpOnly or secure flags, leaving session vulnerable to script access and insecure transport - should set httpOnly: true and secure: true for HTTPS deployments"
      }
     ],
     "extra_claims": [],
     "missed": [
      "The /sf_session=([^;]+)/ regex is not anchored to a cookie boundary, so a cookie such as old_sf_session=... is matched instead of (or in place of) sf_session."
     ]
    },
    "codeant": {
     "found": 1,
     "extra": 0,
     "matched": [
      {
       "known_issue": "app.use(cors) is registered after the /health, /products and /orders routes, which end the response, so those responses never get CORS headers and the storefront cannot call the API.",
       "tool_claim": "CORS middleware runs after route handlers, causing API responses to finish before CORS headers are set, which makes browser requests from the storefront fail CORS checks"
      }
     ],
     "extra_claims": [],
     "missed": [
      "cors() reflects any request Origin into Access-Control-Allow-Origin together with Allow-Credentials: true, so any website can make credentialed requests and read the responses; there is no storefront/preview allowlist.",
      "startSession stores the raw customerId in sf_session unsigned and sessionCustomer returns it as the signed-in customer, so a client can set sf_session=cus_00001 and impersonate any customer once these helpers are used.",
      "The sf_session cookie is set for 30 days without httpOnly or secure, so it is readable by page scripts and can be sent over plain HTTP.",
      "The /sf_session=([^;]+)/ regex is not anchored to a cookie boundary, so a cookie such as old_sf_session=... is matched instead of (or in place of) sf_session."
     ]
    }
   }
  },
  {
   "original_pr": 10,
   "tools": {
    "codzee": {
     "found": 6,
     "extra": 2,
     "matched": [
      {
       "known_issue": "SHIPPING_SECRET falls back to '' when SHIPPING_WEBHOOK_SECRET is unset, so the HMAC key is empty and anyone can forge courier events that cancel orders and restock inventory.",
       "tool_claim": "SHIPPING_SECRET falls back to empty string when SHIPPING_WEBHOOK_SECRET is unset, allowing anyone to compute a valid x-courier-signature and forge webhooks"
      },
      {
       "known_issue": "The expected signature is computed over JSON.stringify(req.body) instead of the raw bytes the courier signed, so genuine courier calls with different whitespace or key order are rejected with 401.",
       "tool_claim": "HMAC signature is computed over JSON.stringify(req.body) instead of raw bytes, causing valid webhooks to fail due to whitespace/key order differences and weakening signature guarantees"
      },
      {
       "known_issue": "parcel.returned adds stock back without checking order.status, so courier retries, or a return for an order already cancelled via /orders/:id/cancel, restock the same items again and inflate inventory.",
       "tool_claim": "parcel.returned branch has no check on order.status, causing stock to be restocked twice on courier retry or when order was already cancelled"
      },
      {
       "known_issue": "parcel.shipped sets status = 'shipped' regardless of current status, so a late shipped event reopens a cancelled/returned order (whose stock was released) and an unpaid pending order can be marked shipped.",
       "tool_claim": "parcel.shipped branch sets order.status to shipped without checking current status, allowing cancelled or unpaid orders to be marked shipped"
      },
      {
       "known_issue": "The documented x-courier-timestamp header is never read or signed, so a captured signed event can be replayed at any time.",
       "tool_claim": "Webhook replay is never rejected - x-courier-timestamp is never read and no event id is recorded, allowing captured signed requests to be re-sent indefinitely"
      },
      {
       "known_issue": "The signature is compared with !== instead of timingSafeEqual, leaking timing information.",
       "tool_claim": "Signature compared with non-constant-time !== operator instead of crypto.timingSafeEqual, leaking timing information about HMAC matches"
      }
     ],
     "extra_claims": [
      "Non-null assertion products.get(line.productId)!.stock throws TypeError if product no longer exists, causing partial restock with no status update",
      "Unknown events and bad body return 200 OK instead of proper error responses, silently acknowledging unhandled events"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 5,
     "extra": 1,
     "matched": [
      {
       "known_issue": "SHIPPING_SECRET falls back to '' when SHIPPING_WEBHOOK_SECRET is unset, so the HMAC key is empty and anyone can forge courier events that cancel orders and restock inventory.",
       "tool_claim": "Webhook requests should be rejected when SHIPPING_WEBHOOK_SECRET is missing or empty, as an empty HMAC key allows external senders to compute matching signatures and change order status or stock"
      },
      {
       "known_issue": "The expected signature is computed over JSON.stringify(req.body) instead of the raw bytes the courier signed, so genuine courier calls with different whitespace or key order are rejected with 401.",
       "tool_claim": "HMAC should be computed over the original request body bytes, not JSON.stringify(req.body), because re-serialization removes spaces and causes valid courier signatures to be rejected"
      },
      {
       "known_issue": "parcel.returned adds stock back without checking order.status, so courier retries, or a return for an order already cancelled via /orders/:id/cancel, restock the same items again and inflate inventory.",
       "tool_claim": "Duplicate parcel.returned requests restore stock multiple times, causing inventory inflation (e.g., quantity 2 adds 4 units for one return)"
      },
      {
       "known_issue": "parcel.shipped sets status = 'shipped' regardless of current status, so a late shipped event reopens a cancelled/returned order (whose stock was released) and an unpaid pending order can be marked shipped.",
       "tool_claim": "Delayed parcel.shipped events can reopen orders that were already cancelled via parcel.returned, causing inconsistent order state where order appears shipped but stock was already restored"
      },
      {
       "known_issue": "The signature is compared with !== instead of timingSafeEqual, leaking timing information.",
       "tool_claim": "Signature comparison uses !== which is vulnerable to timing attacks; should use crypto.timingSafeEqual with buffer length check first"
      }
     ],
     "extra_claims": [
      "The return path can leave partially applied inventory changes if a later order line references a missing product, and retries can repeat those increments"
     ],
     "missed": [
      "The documented x-courier-timestamp header is never read or signed, so a captured signed event can be replayed at any time."
     ]
    },
    "greptile": {
     "found": 4,
     "extra": 0,
     "matched": [
      {
       "known_issue": "SHIPPING_SECRET falls back to '' when SHIPPING_WEBHOOK_SECRET is unset, so the HMAC key is empty and anyone can forge courier events that cancel orders and restock inventory.",
       "tool_claim": "Missing secret allows forged requests - If SHIPPING_WEBHOOK_SECRET is unset, SHIPPING_SECRET becomes a publicly known empty string, allowing anyone to sign their own request and change existing orders or restore stock"
      },
      {
       "known_issue": "The expected signature is computed over JSON.stringify(req.body) instead of the raw bytes the courier signed, so genuine courier calls with different whitespace or key order are rejected with 401.",
       "tool_claim": "Valid courier signatures get rejected - JSON.stringify(req.body) does not preserve the body the courier signed, causing correctly signed requests to fail HMAC verification due to whitespace differences"
      },
      {
       "known_issue": "parcel.returned adds stock back without checking order.status, so courier retries, or a return for an order already cancelled via /orders/:id/cancel, restock the same items again and inflate inventory.",
       "tool_claim": "Repeated returns add stock twice - Every accepted parcel.returned request adds order quantities back even when the order is already cancelled, causing duplicate stock restoration on retries"
      },
      {
       "known_issue": "parcel.shipped sets status = 'shipped' regardless of current status, so a late shipped event reopens a cancelled/returned order (whose stock was released) and an unpaid pending order can be marked shipped.",
       "tool_claim": "Returned orders become shipped - A delayed parcel.shipped request arriving after parcel.returned overwrites cancelled status even though the return already restored stock, making returned orders appear shipped"
      }
     ],
     "extra_claims": [],
     "missed": [
      "The documented x-courier-timestamp header is never read or signed, so a captured signed event can be replayed at any time.",
      "The signature is compared with !== instead of timingSafeEqual, leaking timing information."
     ]
    },
    "codeant": {
     "found": 0,
     "extra": 0,
     "matched": [],
     "extra_claims": [],
     "missed": [
      "SHIPPING_SECRET falls back to '' when SHIPPING_WEBHOOK_SECRET is unset, so the HMAC key is empty and anyone can forge courier events that cancel orders and restock inventory.",
      "The expected signature is computed over JSON.stringify(req.body) instead of the raw bytes the courier signed, so genuine courier calls with different whitespace or key order are rejected with 401.",
      "parcel.returned adds stock back without checking order.status, so courier retries, or a return for an order already cancelled via /orders/:id/cancel, restock the same items again and inflate inventory.",
      "parcel.shipped sets status = 'shipped' regardless of current status, so a late shipped event reopens a cancelled/returned order (whose stock was released) and an unpaid pending order can be marked shipped.",
      "The documented x-courier-timestamp header is never read or signed, so a captured signed event can be replayed at any time.",
      "The signature is compared with !== instead of timingSafeEqual, leaking timing information."
     ]
    }
   }
  },
  {
   "original_pr": 11,
   "tools": {
    "codzee": {
     "found": 6,
     "extra": 3,
     "matched": [
      {
       "known_issue": "POST /gift-cards creates a card for any amountCents with no authentication or payment verification, so anyone can mint gift cards and redeem them for free goods.",
       "tool_claim": "POST / creates a gift card for any amountCents with no authentication and no proof of payment, allowing anyone to mint free gift cards"
      },
      {
       "known_issue": "/redeem computes amount from card.balanceCents, then awaits recordRedemption (~200 ms) before decrementing, so concurrent redemptions both spend the same balance (card goes negative, orders marked paid).",
       "tool_claim": "Concurrent redeems double-spend a card because /redeem computes amount from card.balanceCents, then awaits recordRedemption (200 ms) before decrementing, so two concurrent requests both see the full balance"
      },
      {
       "known_issue": "/redeem never checks that the order is pending, so a cancelled (or already paid) order with a positive total can be charged to the card and flipped to 'paid'.",
       "tool_claim": "Redeem pays cancelled and shipped orders because /redeem never checks order.status, allowing cancelled orders to become paid and shipped orders to regress to paid"
      },
      {
       "known_issue": "console.log('gift card sold', card) and recordRedemption log the full gift card code, which is the only secret protecting the balance.",
       "tool_claim": "Gift card code is written to logs via console.log, exposing the bearer credential needed to spend the balance to anyone with log access"
      },
      {
       "known_issue": "After a partial redemption the order stays pending, and POST /orders/:id/cancel then cancels it and releases stock without refunding the amount taken from the gift card.",
       "tool_claim": "Cancelling a part-paid order forfeits the card value because /redeem lowers order.totalCents and keeps no link to the card, so card balance is never restored on cancel"
      },
      {
       "known_issue": "recordRedemption only sleeps and logs; nothing is written to a finance ledger even though the PR says redemptions are recorded there.",
       "tool_claim": "recordRedemption is a stub that only sleeps 200 ms and logs, nothing is written to a finance ledger while /redeem returns success"
      }
     ],
     "extra_claims": [
      "Amount validation accepts unsafe integers because Number.isInteger passes values like 1e21 or 9007199254740993 which exceed safe integer range",
      "Cards Map is module-local instead of in store.ts, so cards stay in memory and are lost on restart, and resetStore() doesn't clear it causing state leaks between tests",
      "Lowercase or spaced codes never match because newCode() issues uppercase codes but cards.get(code) looks up the raw request value without normalization"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 5,
     "extra": 2,
     "matched": [
      {
       "known_issue": "POST /gift-cards creates a card for any amountCents with no authentication or payment verification, so anyone can mint gift cards and redeem them for free goods.",
       "tool_claim": "Authorization bypass: POST /gift-cards creates a card with balanceCents from request body without authentication middleware or payment settlement check, allowing free gift card issuance"
      },
      {
       "known_issue": "/redeem computes amount from card.balanceCents, then awaits recordRedemption (~200 ms) before decrementing, so concurrent redemptions both spend the same balance (card goes negative, orders marked paid).",
       "tool_claim": "Race condition in redemption: balance check and debit are not serialized, allowing concurrent requests to overdraw card balances or reduce order totals below zero"
      },
      {
       "known_issue": "/redeem never checks that the order is pending, so a cancelled (or already paid) order with a positive total can be charged to the card and flipped to 'paid'.",
       "tool_claim": "Gift card redemption does not check order status, allowing cancelled orders to be marked as paid and causing customers to lose gift card value"
      },
      {
       "known_issue": "console.log('gift card sold', card) and recordRedemption log the full gift card code, which is the only secret protecting the balance.",
       "tool_claim": "Sensitive data exposure: Gift card codes are logged at line 24 and line 46, allowing anyone with log access to steal and redeem card balances"
      },
      {
       "known_issue": "recordRedemption only sleeps and logs; nothing is written to a finance ledger even though the PR says redemptions are recorded there.",
       "tool_claim": "recordRedemption does not write to a finance ledger as documented - it only waits 200ms and logs to console, meaning payments take effect without ledger records"
      }
     ],
     "extra_claims": [
      "Gift card balances have no durable store - a restart discards all card state",
      "Redemption endpoint does not verify caller authority over the selected order - any valid card code can change any order's amount and mark it paid"
     ],
     "missed": [
      "After a partial redemption the order stays pending, and POST /orders/:id/cancel then cancels it and releases stock without refunding the amount taken from the gift card."
     ]
    },
    "greptile": {
     "found": 6,
     "extra": 0,
     "matched": [
      {
       "known_issue": "POST /gift-cards creates a card for any amountCents with no authentication or payment verification, so anyone can mint gift cards and redeem them for free goods.",
       "tool_claim": "POST /gift-cards creates spendable credit from any caller's amountCents without checking payment, allowing callers to create free credit"
      },
      {
       "known_issue": "/redeem computes amount from card.balanceCents, then awaits recordRedemption (~200 ms) before decrementing, so concurrent redemptions both spend the same balance (card goes negative, orders marked paid).",
       "tool_claim": "Concurrent redemptions can spend credit twice due to race condition - both requests read balance before either subtracts, allowing double-spending"
      },
      {
       "known_issue": "/redeem never checks that the order is pending, so a cancelled (or already paid) order with a positive total can be charged to the card and flipped to 'paid'.",
       "tool_claim": "/redeem accepts cancelled orders because it only checks if order exists, allowing cancelled orders to become paid without reserving stock"
      },
      {
       "known_issue": "console.log('gift card sold', card) and recordRedemption log the full gift card code, which is the only secret protecting the balance.",
       "tool_claim": "Sale log and recordRedemption log expose full gift-card codes, allowing anyone with log access to steal and spend remaining balance"
      },
      {
       "known_issue": "After a partial redemption the order stays pending, and POST /orders/:id/cancel then cancels it and releases stock without refunding the amount taken from the gift card.",
       "tool_claim": "Partial redemption leaves order pending, allowing cancellation which releases stock but never returns the gift-card credit"
      },
      {
       "known_issue": "recordRedemption only sleeps and logs; nothing is written to a finance ledger even though the PR says redemptions are recorded there.",
       "tool_claim": "recordRedemption only waits and logs but never writes to a finance ledger, so redemptions succeed without creating required finance records"
      }
     ],
     "extra_claims": [],
     "missed": []
    },
    "codeant": {
     "found": 2,
     "extra": 1,
     "matched": [
      {
       "known_issue": "/redeem computes amount from card.balanceCents, then awaits recordRedemption (~200 ms) before decrementing, so concurrent redemptions both spend the same balance (card goes negative, orders marked paid).",
       "tool_claim": "Race condition: amount is calculated before the ledger await, so concurrent redemptions can both record and subtract the same balance, driving the card or order below zero"
      },
      {
       "known_issue": "console.log('gift card sold', card) and recordRedemption log the full gift card code, which is the only secret protecting the balance.",
       "tool_claim": "Full redeemable gift card code is logged to application logs, allowing anyone with log access to spend the sold card without customer authorization"
      }
     ],
     "extra_claims": [
      "Number.isInteger accepts unsafe integers, causing large requested cent values to be rounded by JavaScript, so the stored gift-card balance differs from the amount charged"
     ],
     "missed": [
      "POST /gift-cards creates a card for any amountCents with no authentication or payment verification, so anyone can mint gift cards and redeem them for free goods.",
      "/redeem never checks that the order is pending, so a cancelled (or already paid) order with a positive total can be charged to the card and flipped to 'paid'.",
      "After a partial redemption the order stays pending, and POST /orders/:id/cancel then cancels it and releases stock without refunding the amount taken from the gift card.",
      "recordRedemption only sleeps and logs; nothing is written to a finance ledger even though the PR says redemptions are recorded there."
     ]
    }
   }
  },
  {
   "original_pr": 12,
   "tools": {
    "codzee": {
     "found": 7,
     "extra": 4,
     "matched": [
      {
       "known_issue": "/verify has no attempt limit, lockout or rate limit, so an attacker can try all 1,000,000 six-digit codes against a customer id (ids are sequential) and sign in as them.",
       "tool_claim": "Unlimited guesses on /verify endpoint - no attempt counter, lockout or rate limit allows brute-forcing all 1,000,000 six-digit codes against any customer ID"
      },
      {
       "known_issue": "/start console.logs the plaintext sign-in code with the email, so anyone with log access can sign in as any customer, defeating the hashed storage.",
       "tool_claim": "Sign-in code written to logs via console.log, exposing plaintext six-digit code and customer email to anyone with log access"
      },
      {
       "known_issue": "/verify never checks challenge.expiresAt, so codes stay valid indefinitely instead of expiring after five minutes.",
       "tool_claim": "Expired codes are still accepted - /verify never compares challenge.expiresAt with Date.now(), so the five-minute expiry is not enforced"
      },
      {
       "known_issue": "/verify does not delete the challenge on success, so the same code can be used to sign in repeatedly.",
       "tool_claim": "Verified code can be replayed - /verify doesn't delete the challenge after success, allowing the same code to be reused indefinitely"
      },
      {
       "known_issue": "/verify only returns { signedIn: true, customerId } and issues no session cookie or token, so nothing proves the sign-in on later requests despite the 'we start a session' comment.",
       "tool_claim": "Sign-in issues no session or token - /verify returns signedIn: true but creates no session, cookie or token to prove authentication"
      },
      {
       "known_issue": "/verify requires the internal customerId, but /start only takes an email and returns { sent: true }, so a real customer has no way to learn the id needed to finish sign-in.",
       "tool_claim": "Verify needs an id the customer never gets - /start takes email and returns only { sent: true }, but /verify requires customerId which customer doesn't have"
      },
      {
       "known_issue": "/start never sends an email; it only logs the code, so the advertised email delivery is not implemented.",
       "tool_claim": "Code is never emailed but API says sent - /start has no email-sending call, only console.log, yet responds with { sent: true }"
      }
     ],
     "extra_claims": [
      "Verify responses reveal which customers exist - different error responses (400 no_challenge vs 401 wrong_code) enable user enumeration",
      "No throttle on /start enables email bombing - no per-email or per-IP limit allows flooding victim's inbox or invalidating their codes",
      "Email lookup is case-sensitive and unnormalised - comparing raw input without trimming or lowercasing causes silent failures for valid customers",
      "Unsalted SHA-256 and non-constant-time compare - plain unsalted SHA-256 of small value space reverses instantly, and != comparison is not timing-safe"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 6,
     "extra": 1,
     "matched": [
      {
       "known_issue": "/verify has no attempt limit, lockout or rate limit, so an attacker can try all 1,000,000 six-digit codes against a customer id (ids are sequential) and sign in as them.",
       "tool_claim": "No rate limiting on verification attempts: failed /verify attempts have no bound, allowing unlimited brute-force guessing of the six-digit code (CWE-307)"
      },
      {
       "known_issue": "/start console.logs the plaintext sign-in code with the email, so anyone with log access can sign in as any customer, defeating the hashed storage.",
       "tool_claim": "Sensitive data exposure: console.log statement writes plaintext sign-in code and email address to application logs, exposing authentication credentials to log readers (CWE-532)"
      },
      {
       "known_issue": "/verify never checks challenge.expiresAt, so codes stay valid indefinitely instead of expiring after five minutes.",
       "tool_claim": "Expired challenges not rejected: /verify endpoint never reads expiresAt field, allowing codes to be used after the five-minute expiry window (CWE-613)"
      },
      {
       "known_issue": "/verify does not delete the challenge on success, so the same code can be used to sign in repeatedly.",
       "tool_claim": "Challenge not consumed after successful verification: same valid code can be replayed multiple times since the challenge is not deleted after successful use (CWE-294)"
      },
      {
       "known_issue": "/verify only returns { signedIn: true, customerId } and issues no session cookie or token, so nothing proves the sign-in on later requests despite the 'we start a session' comment.",
       "tool_claim": "No authenticated session created: successful /verify returns { signedIn: true } but does not set a cookie, return a token, or store session state, leaving the customer unauthenticated for subsequent requests"
      },
      {
       "known_issue": "/start never sends an email; it only logs the code, so the advertised email delivery is not implemented.",
       "tool_claim": "Email delivery not implemented: /start endpoint stores the code and logs it but never actually sends the email, yet returns { sent: true } to the customer"
      }
     ],
     "extra_claims": [
      "Public issuance unconditionally replaces pending challenges: a caller who knows an email can invalidate another customer's pending code without proving mailbox ownership"
     ],
     "missed": [
      "/verify requires the internal customerId, but /start only takes an email and returns { sent: true }, so a real customer has no way to learn the id needed to finish sign-in."
     ]
    },
    "greptile": {
     "found": 7,
     "extra": 0,
     "matched": [
      {
       "known_issue": "/verify has no attempt limit, lockout or rate limit, so an attacker can try all 1,000,000 six-digit codes against a customer id (ids are sequential) and sign in as them.",
       "tool_claim": "/verify leaves the challenge unchanged after a wrong guess, allowing unlimited brute force attempts on the one-million possible codes"
      },
      {
       "known_issue": "/start console.logs the plaintext sign-in code with the email, so anyone with log access can sign in as any customer, defeating the hashed storage.",
       "tool_claim": "/start writes each customer's email and usable sign-in code to application logs, exposing secrets to log readers"
      },
      {
       "known_issue": "/verify never checks challenge.expiresAt, so codes stay valid indefinitely instead of expiring after five minutes.",
       "tool_claim": "/verify never checks challenge.expiresAt, allowing expired codes to still work and return signedIn: true after five minutes"
      },
      {
       "known_issue": "/verify does not delete the challenge on success, so the same code can be used to sign in repeatedly.",
       "tool_claim": "/verify does not consume a successfully used code, allowing the same code to be reused multiple times"
      },
      {
       "known_issue": "/verify only returns { signedIn: true, customerId } and issues no session cookie or token, so nothing proves the sign-in on later requests despite the 'we start a session' comment.",
       "tool_claim": "/verify reports sign-in success without creating a session or issuing a token, giving customers no usable signed-in state"
      },
      {
       "known_issue": "/verify requires the internal customerId, but /start only takes an email and returns { sent: true }, so a real customer has no way to learn the id needed to finish sign-in.",
       "tool_claim": "/verify requires an internal customerId but customers only have email addresses and /start returns only sent: true, making it impossible to complete sign-in"
      },
      {
       "known_issue": "/start never sends an email; it only logs the code, so the advertised email delivery is not implemented.",
       "tool_claim": "/start never sends an email but returns sent: true, so customers cannot obtain the promised code from their inbox"
      }
     ],
     "extra_claims": [],
     "missed": []
    },
    "codeant": {
     "found": 3,
     "extra": 0,
     "matched": [
      {
       "known_issue": "/verify never checks challenge.expiresAt, so codes stay valid indefinitely instead of expiring after five minutes.",
       "tool_claim": "expiresAt is never checked, so a code remains valid after five minutes and can authorize sign-in indefinitely"
      },
      {
       "known_issue": "/verify only returns { signedIn: true, customerId } and issues no session cookie or token, so nothing proves the sign-in on later requests despite the 'we start a session' comment.",
       "tool_claim": "Successful verification response does not establish a server-side session or provide a session credential, so later requests cannot authenticate from this sign-in"
      },
      {
       "known_issue": "/start never sends an email; it only logs the code, so the advertised email delivery is not implemented.",
       "tool_claim": "OTP code is only written to server logs and no email is sent, so customers cannot receive the code needed to sign in"
      }
     ],
     "extra_claims": [],
     "missed": [
      "/verify has no attempt limit, lockout or rate limit, so an attacker can try all 1,000,000 six-digit codes against a customer id (ids are sequential) and sign in as them.",
      "/start console.logs the plaintext sign-in code with the email, so anyone with log access can sign in as any customer, defeating the hashed storage.",
      "/verify does not delete the challenge on success, so the same code can be used to sign in repeatedly.",
      "/verify requires the internal customerId, but /start only takes an email and returns { sent: true }, so a real customer has no way to learn the id needed to finish sign-in."
     ]
    }
   }
  },
  {
   "original_pr": 13,
   "tools": {
    "codzee": {
     "found": 5,
     "extra": 1,
     "matched": [
      {
       "known_issue": "The HMAC is computed over JSON.stringify(req.body) rather than the raw bytes the warehouse signed, so genuine pushes whose serialization differs are rejected with 401 and stock silently drifts.",
       "tool_claim": "HMAC checked over re-serialised JSON body instead of raw bytes - expected is computed over JSON.stringify(req.body) not the raw bytes the warehouse signed, causing valid pushes to fail if serialisation differs"
      },
      {
       "known_issue": "sentAt is documented but never read and product.stock = stock is applied unconditionally, so a delayed, retried or replayed older push overwrites a newer stock count (e.g. restoring sold-out stock).",
       "tool_claim": "Replayed or stale sync overwrites current stock - signature covers only the body, sentAt is never compared to a tolerance, and no event id or last-applied timestamp is stored per sku, allowing captured requests to reset stock to old values"
      },
      {
       "known_issue": "timingSafeEqual throws a RangeError when the buffers differ in length, so a missing, short or non-hex x-warehouse-signature produces a 500 instead of the 401 bad_signature response.",
       "tool_claim": "Bad or missing signature returns 500 instead of 401 - timingSafeEqual throws RangeError when buffers differ in length, so missing header or malformed values cause handler to throw instead of returning bad_signature"
      },
      {
       "known_issue": "stock is written without type or range validation, so a missing, string, negative or fractional value is stored and reserve()'s stock < quantity check then lets the product be oversold.",
       "tool_claim": "Unvalidated stock value can disable stock checks - stock from req.body has no type or range check, allowing undefined/string/negative/float/NaN values that break the out_of_stock check in reserve()"
      },
      {
       "known_issue": "The stock sync writes the warehouse count as an absolute stock value, overwriting units already reserved by pending orders, so reserved stock is resold and can go negative.",
       "tool_claim": "Absolute stock overwrites pending-order reservations - product.stock = stock replaces count with warehouse shelf number but reserve() has already decremented stock for pending orders, causing incorrect inventory counts"
      }
     ],
     "extra_claims": [
      "Warehouse sku looked up as product id - products.get(sku) treats warehouse sku as key of products map which is keyed by product id, causing unknown_sku errors unless warehouse sends internal ids"
     ],
     "missed": []
    },
    "coderabbit": {
     "found": 4,
     "extra": 1,
     "matched": [
      {
       "known_issue": "The HMAC is computed over JSON.stringify(req.body) rather than the raw bytes the warehouse signed, so genuine pushes whose serialization differs are rejected with 401 and stock silently drifts.",
       "tool_claim": "Line 15 computes the expected digest from JSON.stringify(req.body) which re-serializes the parsed object, potentially differing from the original bytes sent by the warehouse (whitespace, key order, number formatting), causing valid signatures to fail"
      },
      {
       "known_issue": "sentAt is documented but never read and product.stock = stock is applied unconditionally, so a delayed, retried or replayed older push overwrites a newer stock count (e.g. restoring sold-out stock).",
       "tool_claim": "The /stock handler accepts any body with valid signature and writes stock unconditionally without checking sentAt timestamp, allowing older snapshots to overwrite newer counts"
      },
      {
       "known_issue": "timingSafeEqual throws a RangeError when the buffers differ in length, so a missing, short or non-hex x-warehouse-signature produces a 500 instead of the 401 bad_signature response.",
       "tool_claim": "If the signature header is absent, timingSafeEqual throws when buffer lengths differ instead of returning 401 bad_signature - need to check signature.length === expected.length before calling timingSafeEqual"
      },
      {
       "known_issue": "stock is written without type or range validation, so a missing, string, negative or fractional value is stored and reserve()'s stock < quantity check then lets the product be oversold.",
       "tool_claim": "A correctly signed body with stock:null or missing stock passes all guards and stores null/undefined as the stock count - need to validate stock is a non-negative integer before mutation"
      }
     ],
     "extra_claims": [
      "POST /sync/stock uses warehouse sku directly as key for products but catalog keys products by generated prod_ identifiers and Product has no sku field, causing valid updates to return 404 unknown_sku"
     ],
     "missed": [
      "The stock sync writes the warehouse count as an absolute stock value, overwriting units already reserved by pending orders, so reserved stock is resold and can go negative."
     ]
    },
    "greptile": {
     "found": 4,
     "extra": 1,
     "matched": [
      {
       "known_issue": "sentAt is documented but never read and product.stock = stock is applied unconditionally, so a delayed, retried or replayed older push overwrites a newer stock count (e.g. restoring sold-out stock).",
       "tool_claim": "Old updates restore sold-out stock: The handler ignores sentAt, so an older signed update can overwrite a newer count. Applying a count of 0 and then retrying an earlier signed count of 10 restores unavailable units and lets customers order them. Track the last accepted update per product and reject stale or repeated updates before changing stock."
      },
      {
       "known_issue": "timingSafeEqual throws a RangeError when the buffers differ in length, so a missing, short or non-hex x-warehouse-signature produces a 500 instead of the 401 bad_signature response.",
       "tool_claim": "Missing signatures cause server errors: A missing or short x-warehouse-signature throws instead of returning 401. timingSafeEqual requires equal-length buffers, but a missing header becomes an empty buffer while the expected SHA-256 digest has 32 bytes. Check the decoded length before comparing so invalid signatures receive the intended response."
      },
      {
       "known_issue": "stock is written without type or range validation, so a missing, string, negative or fractional value is stored and reserve()'s stock < quantity check then lets the product be oversold.",
       "tool_claim": "Missing counts bypass stock limits: A valid signature does not ensure that stock is a valid count. A signed body with a known sku but no stock stores undefined. The comparison in reserve then fails to reject orders, and subtraction turns the count into NaN, allowing further orders without a working stock limit. Check the body and require a nonnegative integer before changing the product."
      },
      {
       "known_issue": "The stock sync writes the warehouse count as an absolute stock value, overwriting units already reserved by pending orders, so reserved stock is resold and can go negative.",
       "tool_claim": "Reserved units become available again: Assigning the warehouse's shelf count directly to product.stock erases stock held for pending orders. If the warehouse has 10 units, an order reserves 2, and a delivery adds 5, the push sets availability to 15 instead of 13. Other customers can then buy those reserved units. Keep pending reservations separate and subtract them from the warehouse count."
      }
     ],
     "extra_claims": [
      "Setup leaves stock sync broken: The route requires WAREHOUSE_SECRET, but the setup instructions never mention it and startup does not check it. If the environment does not supply the secret, every stock push passes undefined to createHmac and fails. Document the required secret and check it at startup, or explicitly disable the route when it is absent."
     ],
     "missed": [
      "The HMAC is computed over JSON.stringify(req.body) rather than the raw bytes the warehouse signed, so genuine pushes whose serialization differs are rejected with 401 and stock silently drifts."
     ]
    },
    "codeant": {
     "found": 2,
     "extra": 0,
     "matched": [
      {
       "known_issue": "timingSafeEqual throws a RangeError when the buffers differ in length, so a missing, short or non-hex x-warehouse-signature produces a 500 instead of the 401 bad_signature response.",
       "tool_claim": "A missing or malformed signature decodes to a buffer not 32 bytes; timingSafeEqual throws instead of returning 401, so unauthenticated requests produce 500 errors"
      },
      {
       "known_issue": "The stock sync writes the warehouse count as an absolute stock value, overwriting units already reserved by pending orders, so reserved stock is resold and can go negative.",
       "tool_claim": "Stock snapshots overwrite product.stock without accounting for pending order reservations, so cancelling an order can restore units already included in the snapshot and permit overselling"
      }
     ],
     "extra_claims": [],
     "missed": [
      "The HMAC is computed over JSON.stringify(req.body) rather than the raw bytes the warehouse signed, so genuine pushes whose serialization differs are rejected with 401 and stock silently drifts.",
      "sentAt is documented but never read and product.stock = stock is applied unconditionally, so a delayed, retried or replayed older push overwrites a newer stock count (e.g. restoring sold-out stock).",
      "stock is written without type or range validation, so a missing, string, negative or fractional value is stored and reserve()'s stock < quantity check then lets the product be oversold."
     ]
    }
   }
  }
 ]
}