Repository navigation
Commit 64e0ed5
committed
fix(policy): load the authorization snapshot under the configured kind
FIX-MTR-22. `load_latest_authz_json` parsed main's root tree with
`Tree::from_mega_model`, which derives every entry id from the thread-local
HashKind. On a SHA-256 monorepo that panics or resolves the wrong blob id, so
the authorization snapshot could not load at all.
It now parses through `tree_from_mega_model_with_kind` with
`monorepo.object_hash_kind()` and propagates a parse failure as an error. The
published-version CAS, the monotonic swap, the dirty fallback and the read
barrier are unchanged, and no production unwrap was added.
Tests: a three-algorithm matrix seeds `main@/` with a `/.mega_cedar.json` blob
under each of SHA-1, SHA-256 and Blake3, then loads with an opposing
thread-local kind and asserts the exact bytes plus an unchanged TLS kind; a
negative case supplies a truncated tree entry id and asserts an error. Both
hold the module's POLICY_TEST_SERIAL lock so they cannot consume the
process-global publish/rebuild hooks.
Verified: cargo nextest run --all --no-fail-fast 3124/3124 passed (3
pre-existing ignores) in 678s; contract::policy:: 157/157 under parallel
threads; VER-1 RED replay fails on the pre-fix loader with
InvalidLength { kind: Sha256, expected: 64, actual: 40 }; the audit script
passes. Independent review returned VERDICT: PASS.
Version 0.42.85 -> 0.42.86 (patch; dependencies unchanged).
Signed-off-by: Eli Ma <eli@patch.sh>1 parent b4b4d0a commit 64e0ed5
5 files changed
Lines changed: 170 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5508 | 5508 | | |
5509 | 5509 | | |
5510 | 5510 | | |
5511 | | - | |
5512 | | - | |
5513 | | - | |
| 5511 | + | |
5514 | 5512 | | |
| 5513 | + | |
| 5514 | + | |
| 5515 | + | |
| 5516 | + | |
5515 | 5517 | | |
5516 | 5518 | | |
5517 | 5519 | | |
5518 | 5520 | | |
5519 | 5521 | | |
5520 | 5522 | | |
5521 | 5523 | | |
5522 | | - | |
5523 | | - | |
5524 | | - | |
5525 | | - | |
5526 | | - | |
5527 | | - | |
| 5524 | + | |
| 5525 | + | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
5528 | 5530 | | |
5529 | 5531 | | |
5530 | | - | |
5531 | | - | |
5532 | | - | |
5533 | | - | |
| 5532 | + | |
| 5533 | + | |
| 5534 | + | |
| 5535 | + | |
5534 | 5536 | | |
5535 | 5537 | | |
5536 | 5538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
530 | 682 | | |
531 | 683 | | |
532 | 684 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
0 commit comments