A malformed body gets JavaScript's own words back, a 409, and one of them empties the board #1309
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge#1309
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Every test in this repository drove the engine. I drove the HTTP surface with malformed requests on purpose,
and three failures came out — one of them is data loss.
1.
POST /loadempties the board and says it workedThe live topology is replaced by whatever the body says, and
Topology.fromJSON()is (deliberately) tolerant, soa document with the wrong format marker and no devices becomes an empty lab — reported as success, with the
operator's work gone.
{"format":"packetforge-topology"}alone does the same. There is no shape check of any kindbefore the swap.
2. A missing body is dereferenced straight through
The runtime's own words, and the second one calls a missing body a conflict.
/configwith{}and with{commands:[null]}leak the same way, and{"commands":"hostname X"}(a string, not a list) turns into[undefined]... The interface the operator reads is the JSON.3. A request that names nothing blames a device
Both are 400s about a malformed request, not 404s or messages containing
undefined.The three rules that must hold
Cannot read properties, noundefinedin asentence, no
[object Object];exist, 409/422 for content the engine refuses;
empty the board.
Topology.fromJSON()stays tolerant (it reads old files); tolerance belongs to reading, notto replacing.
a bcannot be reached #1315