Code: Jennifer facing hostile input
Jennifer facing hostile input: the code
The programs behind the slides. They run with Jennifer 0.27.0 from this folder and need nothing else: every network demo starts its own fake server in a task on a free 127.0.0.1 port. Error messages print full file paths where the slides shorten them to the file name.
yamlbomb.j: "413 bytes that want to be a billion nodes", all nine lines of the alias bomb. Run:jennifer run yamlbomb.jbombs.j: "Headers that lie, and a zip bomb", withforgedPng(a real 1x1 PNG with a rewritten IHDR and checksum) andreport. Run:jennifer run bombs.jcaps.j: "The caps you get without asking", the decoders' depth caps (5000 opening brackets, 1000 / 1001 and 128 / 129 levels) and the call depth limit. Run:jennifer run caps.jowncaps.j: "Your own caps", each call of the slide with its cap on a small local input, then thejson.decodeWithline of the output. Run:jennifer run owncaps.jwrapper/config.jandwrapper/config_test.j: "A cap must survive your wrappers, so test it", the naive wrapper;testCapStaysLimitfails on purpose. Run:cd wrapper && jennifer test config_test.jfixed/config.jandfixed/config_test.j: the same test against a wrapper that passes the generic kinds through; both tests pass. Run:cd fixed && jennifer test config_test.jmalformed.j: "Malformed bytes: the module's kind", a JPEG cut inside its SOF0 header handed topdf.loadImage. Run:jennifer run malformed.jtlv.j: "Your own parser: check before you read" and "Hostile input meets records", the three hostile inputs, one valid input, and the unchecked loop for the "Without need" line. Run:jennifer run tlv.jpeer.j: "A peer that stalls, a peer that never stops". Takes about 2 s. Run:jennifer run peer.jdrip.j: "A slow drip beats an idle timeout". Takes about 2 s; the milliseconds printed depend on the machine (2000 or a little more). Run:jennifer run drip.jserver.j: "The server side: limits answered with a status", the four clients againsthttpd.listenWithandweb.serveOn. Run:jennifer run server.jweb15.j: "What web does for you at the boundary", the handler error on stderr, the client's bare 500 and the session cookie. Run:jennifer run web15.j, thenJENNIFER_WEB_INSECURE_COOKIES=1 jennifer run web15.jfor the cookie withoutSecureapp.jwithdeck-colors/: "Deck capabilities: a label, not a fence".deck-colors/deck.tomldeclares no capabilities, yetdeck-colors/src/colors.jrunsuname.app.jimports the deck's source file directly; installed withjvcit would be@demo/colors/. Run:jennifer run app.jandjennifer-tiny run app.j(the TinyGo build, which refusesos.run).teal on Linuxnames your system.
| File | Size | |
|---|---|---|
| LICENSE | 899 B | raw |
| README.md | 2.7 KiB | raw |
| app.j | 327 B | raw |
| bombs.j | 1.1 KiB | raw |
| caps.j | 1.2 KiB | raw |
| deck-colors/deck.toml | 364 B | raw |
| deck-colors/src/colors.j | 174 B | raw |
| drip.j | 1.5 KiB | raw |
| fixed/config.j | 481 B | raw |
| fixed/config_test.j | 353 B | raw |
| malformed.j | 546 B | raw |
| owncaps.j | 1.8 KiB | raw |
| peer.j | 1.5 KiB | raw |
| server.j | 1.8 KiB | raw |
| tlv.j | 2.0 KiB | raw |
| web15.j | 1.1 KiB | raw |
| wrapper/config.j | 328 B | raw |
| wrapper/config_test.j | 353 B | raw |
| yamlbomb.j | 735 B | raw |