Commit ae68f22
committed
fix(container): whitespace transport-resistance (issue #1)
A .pbf.json pasted into an email body / reflowed by a text transport could break
two ways, both now fixed + locked with tests:
- strict crc32_encoded rejected whitespace the glyph payload ignores -> compute it
over the CANONICAL payload (data with [CR/LF/TAB/SPACE] stripped). Clean
containers are byte-for-byte unchanged (backward-compatible); only transport-
injected whitespace is tolerated.
- JSON forbids raw newlines inside strings (a hard line-wrap of the long data
line) -> lenient parse: strip raw control whitespace and retry on parse failure.
Applied to decodeFromContainer AND the decodeText router (web + Node CLI path).
Decode strips canonical whitespace before decoding (default decode does not ignore
it). Integrity intact: genuine non-whitespace corruption is still rejected (crc32
of the original bytes, post-decode). Adds 8 JS transport tests (A-G + router +
corruption-still-caught) and a transport-mangle case to the parameterized
test/test_container, so every executable inherits the guard.1 parent a0d29e8 commit ae68f22
4 files changed
Lines changed: 93 additions & 5 deletions
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
679 | 702 | | |
680 | 703 | | |
681 | 704 | | |
682 | 705 | | |
683 | 706 | | |
684 | | - | |
| 707 | + | |
685 | 708 | | |
686 | 709 | | |
687 | 710 | | |
| |||
709 | 732 | | |
710 | 733 | | |
711 | 734 | | |
712 | | - | |
| 735 | + | |
713 | 736 | | |
714 | 737 | | |
715 | 738 | | |
| |||
719 | 742 | | |
720 | 743 | | |
721 | 744 | | |
| 745 | + | |
722 | 746 | | |
723 | | - | |
| 747 | + | |
724 | 748 | | |
725 | 749 | | |
726 | 750 | | |
727 | 751 | | |
728 | | - | |
| 752 | + | |
729 | 753 | | |
730 | 754 | | |
731 | 755 | | |
| |||
756 | 780 | | |
757 | 781 | | |
758 | 782 | | |
759 | | - | |
| 783 | + | |
760 | 784 | | |
761 | 785 | | |
762 | 786 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
377 | 409 | | |
378 | 410 | | |
379 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
0 commit comments