1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! The `permissions:` frontmatter block: captured and re-emitted verbatim (#8199).
//!
//! Why: the composer re-emits frontmatter from the keys it models, so a
//! `permissions:` block on a source card was dropped on deploy, and a deployed
//! trusty-code card ran with every tool allowed. The block is a nested map of
//! tool globs to decisions or argument tables, which the composer's flat
//! `key: value` reader cannot model — and its indented rule keys were being
//! read as top-level fields. trusty-code owns the grammar
//! (`trusty_code::permissions::parse_permissions`); this module only carries
//! the bytes through. `builder.rs` sits at the 500-SLOC cap, so it lives here.
//! What: [`PermissionsBlock`] collects a top-level `permissions:` line and
//! every blank or indented line under it, the same extent trusty-code's
//! extractor reads, and [`PermissionsBlock::finish`] returns it as one
//! newline-terminated string for `merge_frontmatter` to emit unchanged.
//! Test: `permissions_block_survives_compose_verbatim`,
//! `permissions_block_is_leaf_only_and_absent_emits_nothing` in
//! builder_tests.rs; `stock_tcode_roster_deploys_every_frontmatter_key` in
//! deployer_tests.rs.
/// Line-by-line capture of one top-level `permissions:` block.
pub