A ping count is unbounded, and three surfaces take it from whoever asks #1379

Closed
opened 2026-11-10 20:26:28 +00:00 by jaylouisw · 0 comments
Owner

A ping count is a loop bound, and three surfaces take it from whoever asks.

Measured on the current tree (Simulator.ping with a router pinging its own address):

count replies time
5000 5000 23 ms
1e9 — ~4,600 s by extrapolation, and a response nobody can hold
-5 0 0 ms — an empty answer
'abc' 0 0 ms — indistinguishable from a dead network
  • engine/simulator.js ping() does opts.count || 4 and then loops.
  • POST /api/topologies/:id/ping passes body.count straight through — one unauthenticated request away.
  • web/app.js does parseInt(...) || 4. The field carries min=1 max=50, but a browser does not clamp a typed
    value, so 9999 is sent and 9999 replies are drawn.

Same shape as the port-count ceiling (#1319): a number that bounds work, guarded at one door and not the others.

What must be true instead

  1. One rule — a whole number from 1 to 50 — applied at every door.
  2. The engine does not trust its callers: it clamps, falls back for anything that is not a count, and reports both
    count (what was sent) and requestedCount (what was asked for), so a clamp is visible rather than silent.
  3. POST /ping refuses outside the rule with 400 E_BAD_COUNT naming it; an explicit null means "no count".
  4. The console names the rule instead of silently sending four echoes.
  5. The dialog checks before sending.

Also worth fixing while in the parser: a stray word (ping 10.0.0.1 abc) is silently ignored, at later evaluates
to NaN and pings at the wrong instant, and a bare at is dropped.

A ping count is a loop bound, and three surfaces take it from whoever asks. Measured on the current tree (`Simulator.ping` with a router pinging its own address): | count | replies | time | |---|---|---| | 5000 | 5000 | 23 ms | | 1e9 | — | ~4,600 s by extrapolation, and a response nobody can hold | | `-5` | **0** | 0 ms — an empty answer | | `'abc'` | **0** | 0 ms — indistinguishable from a dead network | * `engine/simulator.js` `ping()` does `opts.count || 4` and then loops. * `POST /api/topologies/:id/ping` passes `body.count` straight through — one unauthenticated request away. * `web/app.js` does `parseInt(...) || 4`. The field carries `min=1 max=50`, but a browser does not clamp a typed value, so `9999` is sent and 9999 replies are drawn. Same shape as the port-count ceiling (#1319): a number that bounds work, guarded at one door and not the others. ## What must be true instead 1. One rule — a whole number from 1 to 50 — applied at every door. 2. The engine does not trust its callers: it clamps, falls back for anything that is not a count, and **reports both** `count` (what was sent) and `requestedCount` (what was asked for), so a clamp is visible rather than silent. 3. `POST /ping` refuses outside the rule with `400 E_BAD_COUNT` naming it; an explicit `null` means "no count". 4. The console names the rule instead of silently sending four echoes. 5. The dialog checks before sending. Also worth fixing while in the parser: a stray word (`ping 10.0.0.1 abc`) is silently ignored, `at later` evaluates to `NaN` and pings at the wrong instant, and a bare `at` is dropped.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#1379
No description provided.