diff --git a/crates/core/src/update/trust.rs b/crates/core/src/update/trust.rs index 94f26f7..a4992cc 100644 --- a/crates/core/src/update/trust.rs +++ b/crates/core/src/update/trust.rs @@ -60,7 +60,10 @@ pub(crate) struct PinnedKey { /// (`packaging/sign_manifest.py --check-pinned-keyring` 按标记解析这一段,标记变了它就找不到表)。 pub(crate) const PRODUCTION: &[PinnedKey] = &[ // >>> PINNED-KEYS >>> - PinnedKey { key_id: "ull-release", public_key_hex: "1c3687ecd656a29fda87a7afb56e07d2b9e223b62cf3a6f1a901fb499a97b122" }, + PinnedKey { + key_id: "ull-release", + public_key_hex: "1c3687ecd656a29fda87a7afb56e07d2b9e223b62cf3a6f1a901fb499a97b122", + }, // <<< PINNED-KEYS <<< ]; diff --git a/packaging/sign_manifest.py b/packaging/sign_manifest.py index 0984304..45fddea 100644 --- a/packaging/sign_manifest.py +++ b/packaging/sign_manifest.py @@ -256,6 +256,12 @@ def do_self_test() -> int: if pinned_keys(sample) != [("k1", "ab" * 32)]: print("FAIL: pinned_keys() 没解析出示例条目", file=sys.stderr) failures += 1 + # 多行形态(M261):`trust.rs` 里那一条是 `cargo fmt` 生成的,字段一行一个 —— 靠 `KID_RE` 的 `\s*` + # 跨行命中。若解析器退化成按行匹配,一次 fmt 就会把整张信任表**静默**读成空表(= 全量客户端验签失败)。 + multiline = f'{PIN_BEGIN}\n PinnedKey {{\n key_id: "k1",\n public_key_hex: "{"ab" * 32}",\n }},\n{PIN_END}' + if pinned_keys(multiline) != [("k1", "ab" * 32)]: + print("FAIL: pinned_keys() 没解析出多行(rustfmt)形态的条目", file=sys.stderr) + failures += 1 if pinned_keys(f"{PIN_BEGIN}\n{PIN_END}") != []: print("FAIL: pinned_keys() 在空表上应返回空", file=sys.stderr) failures += 1