fix(domain): refuse three non-canonical v3 shapes, R5.5 LOW fixes, R5.6 plan

check_v3_shape at read_report_document v3 and parse_envelope (sheet, practitioner
as non-objects, severity as non-string); Protocol errors final; DEV address must be
an own unicast address. SQL confirm function and DEV keys characterised, no change.
This commit is contained in:
bchanot committed 2026-10-24 03:34:38 +02:00
1 parent 13db5539a3
commit d502dfa923
11 files changed
+369 -37

No files matched your search

+21 -1
View File
@@ -25,6 +25,8 @@ struct State {
row: Option<(String, bool)>,
bucket_status: u16,
fail_confirm: bool,
/// Answer every request with bytes that are not HTTP.
garbage: bool,
log: Vec<String>,
}
@@ -121,7 +123,14 @@ fn serve(state: Shared) -> u16 {
for stream in listener.incoming() {
let mut stream = stream.unwrap();
let (method, path, body) = read_request(&mut stream);
let (status, reply) = route(&mut state.lock().unwrap(), &method, &path, body);
let mut held = state.lock().unwrap();
if held.garbage {
held.log.push(format!("{method} {path}"));
stream.write_all(b"NOT-HTTP garbage\r\n\r\n").unwrap();
continue;
}
let (status, reply) = route(&mut held, &method, &path, body);
drop(held);
respond(&mut stream, status, &reply);
}
});
@@ -352,3 +361,14 @@ fn a_dev_address_that_is_not_this_machine_is_ignored() {
assert_eq!(output.status.code(), Some(1), "{said}");
assert!(said.contains("Destination"), "{said}");
}
#[test]
fn a_malformed_answer_is_final_and_not_retried() {
let (state, url) = stub();
state.lock().unwrap().garbage = true;
let output = run(&url, &["--check", DRAFT]);
let said = text(&output);
assert_eq!(output.status.code(), Some(1), "{said}");
assert!(said.contains("not retried"), "{said}");
assert_eq!(state.lock().unwrap().log.len(), 1);
}