Skip to content
Back to skills

Request Flow

ASecurity

This is a small custom TypeScript dispatcher (no Express/Nest) — `src/server.ts` maps the string key `"POST /orders"` straight to a handler function, no middleware layer. ```text handleCreateOrder(req) src/routes/orders.ts:3 parses { customerId, items } from JSON body createOrder(customerId, items) src/orders/create.ts:7 validateCart(items) src/orders/validate.ts:1 priceOf(sku) src/orders/validate.ts:7 reserveSto...

  • 17 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 25, 2026
developmenttypescriptexpress

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 25, 2026

npx -y skills add bendrucker/claude --skill request-flow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Request Flow?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Request Flow
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bendrucker-request-flow/badge)](https://www.skillsdirectory.com/skills/bendrucker-request-flow)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
fail: [short-close]
---
This is a small custom TypeScript dispatcher (no Express/Nest) — `src/server.ts` maps the string key `"POST /orders"` straight to a handler function, no middleware layer.

```text
handleCreateOrder(req)                       src/routes/orders.ts:3
  parses { customerId, items } from JSON body

  createOrder(customerId, items)             src/orders/create.ts:7
    validateCart(items)                      src/orders/validate.ts:1
      priceOf(sku)                           src/orders/validate.ts:7
    reserveStock(cart)                       src/orders/inventory.ts:3
    chargeCard(customerId, cart.total)       src/payments/charge.ts:3
      tokenFor(customerId)                   src/payments/vault.ts:1
    persistOrder(customerId, cart, chargeId) src/orders/store.ts:3
    sendReceipt(customerId, order)  [fire-and-forget, not awaited]
                                              src/notify/receipt.ts:1
    releaseStock(hold)  [only on error, after reserveStock succeeded]
                                              src/orders/inventory.ts:9

  returns 201 JSON response
```

**Flow:** validate cart total → reserve stock (in-memory hold) → charge card → persist order → fire receipt → return 201. If `chargeCard` or `persistOrder` throws, `releaseStock` compensates for the reserved stock and re-throws.

Worth knowing:
- **No real backing stores** — `orders` (`store.ts:1`) and `held` (`inventory.ts:1`) are plain in-memory `Array`/`Map`, not a DB. Order `id` is `orders.length + 1`, not concurrency-safe.
- **`tokenFor`** (`vault.ts`) is a stub — fabricates `tok_${customerId}`, no real PSP/vault call.
- **`sendReceipt`** (`create.ts:13`) is called with `void` and not awaited or try/caught — a failure there is silently swallowed and won't roll back or fail the request.
- Rollback only covers errors *after* the stock hold (charge/persist); `validateCart` errors happen before any hold exists, so nothing to release.
- No auth, rate-limiting, or schema-validation middleware wraps this route — `validateCart` is the only check.

Files in this skill

  • sonnet-plain.md2.3 KB
  • sonnet-skill.md2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.