portTemplate.count has no upper bound (1000000 or Infinity kills the boot), and the engine keeps a second copy of the expansion rule #1319
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge#1319
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?
Two findings in the same corner. The second one is a boot-time denial of service.
1. Two copies of the expansion rule, and the test between them could not see the difference
devices/registry.jsandengine/topology.jseach had anexpandInterfaces. The test that was supposed to keepthem in step compared port names over the catalogue — so a divergence in any other field, on any spec outside
the catalogue, or in any edge case, was invisible by construction.
I measured it: over all 2,015 specs the copies agree on every field of every port today, and on every synthetic
edge case I could build. So the drift had not happened yet. But they had already diverged where it counts:
engine/topology.jscarries the comment "the cleanest end state is for engine/topology.js to call this functioninstead of keeping its own copy ... so for now the two are kept in step by that test". The test does not keep them
in step; nothing can.
2.
counthas a documented ceiling that nothing enforceddocs/DEVICE_SCHEMA.md:The loader's gate was
typeof count === 'number' && Math.floor(count) === count && count > 0. So:count: 1000000passes — one number in one file, and the loader builds a million ports at boot;count: Infinitypasses too, becauseMath.floor(Infinity) === InfinityandInfinity > 0. Expanding it neverreturns. Measured against the current code, with the two files reverted:
That is a single spec file, or a hand-edited saved board (
/loadnever passes through the loader), taking theprocess down before it serves anything.
What must be true instead
described since #71;
the file) and by the expander (for the doors the loader does not guard, such as a saved board);
Infinityis reported asInfinity, not asnull(which is whatJSON.stringifygives).