cultnet-rs: pin message validation after the door and the current 18-slot health wire

Mutation survivors of the first run: validate_message -> Ok(()) and the
Some(18) arm of decode_canonical_signed_payload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-16 00:57:53 +02:00
commit a3a03be589
2 changed files with 19 additions and 0 deletions

View file

@ -643,6 +643,11 @@ mod tests {
rmp_serde::from_slice::<IdunnSignedDaemonHealthRecord>(&encoded)?,
health
);
let (decoded, unsigned) =
IdunnSignedDaemonHealthRecord::decode_canonical_signed_payload(&encoded)?;
assert_eq!(decoded, health);
assert_eq!(&unsigned[..3], &[0xdc, 0, 18]);
assert_ne!(unsigned, encoded, "the signed payload excludes the signature");
assert_eq!(
rmp_serde::from_slice::<GameCultServiceTrustAnchorRecord>(&rmp_serde::to_vec(
&anchor

View file

@ -167,6 +167,20 @@ fn generic_message_with_deep_unknown_key_decodes_on_a_small_thread() {
});
}
#[test]
fn a_decoded_message_that_fails_validation_is_refused() {
let bytes = splice(
map_with_sentinel(vec![
("schemaVersion".into(), "cultnet.hello.v0".into()),
("runtimeId".into(), "".into()),
("runtimeKind".into(), "test".into()),
]),
&nested(0),
);
let error = decode_message(bytes, BIG).unwrap_err();
assert!(format!("{error:#}").contains("runtimeId"), "{error:#}");
}
#[test]
fn message_past_the_bound_is_refused_typed() {
in_child("message_past_the_bound_is_refused_typed", || {