Repository navigation
Strict validation compares MSH-9.2 before a same-code borrow keeps the any-segment exemption; batch delivery reads the head's MSH-10 without a full parse (BACKLOG #5920, #5919) - #3194
Conversation
…e any-segment exemption BACKLOG #5920 step 1. A structure borrowed through MSH-9.3 under the message's own code (MFN^M02^MFN_M01) kept the any-HL7-segment exemption. It now keeps it only where the structure is <MSH-9.1>_<MSH-9.2>, or where MSH-9.2 is a non-empty trigger event hl7apy's tables give no structure of its own (PGL^PC7^PGL_PC6). MFN^M02, MFN^M05 and an empty MSH-9.2 borrow are now refused.
…l parse BACKLOG #5919 step 1. The batch caller ran Message.parse on the whole head member to read MSH-10 for BHS-11. head_control_id in parsing/split.py checks the escape budget on the whole text, as the parse does first, and parses the first line alone where that reads MSH-10 as the full parse does; every other head is parsed in full, so it reads or raises as before. wiring_runner.py changes only the read at the batch head.
…cache BACKLOG #5920 and #5919. The structure lookup is cached by version alone, so a sender's MSH-9.2 is never kept. A same-code borrow keeps the exemption only for an event of three capital letters or digits, so a lower-case, padded or blank event fails closed. The rule is stated once, in _exempts_defined_segments; the module docstring and HL7-VALIDATION.md point to it. PGL^PC7^PGL_PC6 is pinned in 2.5 with a 2.5.1 control. _SHORT_LATER_HEADER is built from HEADER_IDS. The _head_separators docstring no longer calls its budget check a second one on hydrated text. Changelog fragment added; a stale test comment fixed.
…orrow case BACKLOG #5920 and #5919. _SHORT_LATER_HEADER is a literal again, so the static ReDoS scanner reads it (test_security_static was red); a test holds its IDs to HEADER_IDS. A same-code borrow keeps the exemption only for an MSH-9.2 in the version's HL7 table 0003 as hl7apy ships it, so a made-up event fails closed. A message with no MSH-9.3 borrows nothing and keeps the exemption as on origin/main. Docs, changelog and comments say what the rule does, including the borrows that keep it.
Two regressions against origin/main in _exempts_defined_segments: a same-code borrow naming its own structure with a padded or lower-case MSH-9.2 (MFN^m01^MFN_M01, MFN^M01 ^MFN_M01), and a Z event borrowing a structure (QBP^Z44^QBP_Q15 in 2.5, QBP^Z44^QBP_Q11 and RSP^Z44^RSP_K11 in 2.8), were refused. Both keep the exemption again, with a test per case. The changelog fragment now reads as a consistency check, since a sender controls all of MSH-9, and the docstring names at least 2.1 to 2.3 as the versions with no table 0003. BACKLOG #5920
…tion The Z test now runs after the own-structure lookup, so QBP^Z73^QBP_Q15 in 2.5 is refused as MFN^M02^MFN_M01 is, and the changelog's refusal condition is true of the code. The docstring, the changelog and docs/HL7-VALIDATION.md state the check order, the raw-value Z test, and the known limit that an event of another family (MFN^A01^MFN_M01) keeps the exemption. The 2.1 to 2.3 clause is dropped: hl7apy refuses an MSH-9.3 there before this check runs. BACKLOG #5920
Text only. hl7apy's 2.7 table 0003 lists Z73 to Z99, so the Z branch is no longer said to exist because the table lists no Z event; the summary line no longer says the structure must be the message's own; and the docstring names that any Z-led value and the table's Varies placeholder pass. The doc's QBP^Z44^QBP_Q15 example names 2.5. BACKLOG #5920
|
Lander: two windows reds on |
|
Lander (session bd594600): cleared at |
|
Lander: enqueuing at |
Strict validation (
_exempts_defined_segments, messagefoundry/parsing/validate.py) now checks MSH-9.2 against a same-code MSH-9.3 borrow before keeping the any-segment exemption: a message naming its own structure (event normalized with strip/upper), a Z event with no hl7apy structure of its own, or an event in the version's table 0003 with no structure of that name keeps it;MFN^M02^MFN_M01,MFN^M05^MFN_M01, empty or made-up events, andQBP^Z73^QBP_Q15in 2.5 (hl7apy has QBP_Z73) are refused. That last one is a deliberate tightening against main (Manager accepts it: Z73 is an HL7-defined query with its own structure). Batch delivery reads the head's MSH-10 from its first line (head_control_id, parsing/split.py) where that gives the same result as a full parse, with one local edit in wiring_runner.py. The changelog reads as a consistency check: a sender controls all of MSH-9.Rows and proposed banners
head_control_idreads MSH-10 from the first line with the same result as a parse (5000-head parity test). Step 2 (escape budget on non-head members: refuse one or the batch) not built; the row does not settle the scope.Review proof
Code-review skill at xhigh; each tag reads
xhigh effort -> 10 inline angles -> dedup (no verify) -> sweep -> <=15 findings, review_tag.py exit 0. round-24501671, round-80adcf52, round-d8c5e777, round-cfcd7160 (1983d8e..79033af, repaired), round-a28aed3e (..9168542, unrepaired); c565c82 after it is docstring and doc text only.Open findings (for one R2 row)
MFN^Zebra^MFN_M01); the Z test reads the raw value whileownis normalized (MFN^Z44 ^MFN_M01kept,MFN^z44refused,PGL^PC7 ^PGL_PC6refused). 2. Table 0003'sVariesplaceholder passes. 3. The table fallback accepts an event from any family (MFN^A01^MFN_M01, pinned as a known limit). 4. Mixed-case hl7apy names (MFN_Znn, RSP_Znn) never match the upper-casedown. 5. A test name covers more than it says. 6. Batch side:_SHORT_LATER_HEADERcopies the parser rule by hand; first-line span logic in three places;test_encode_batchrefusals lack a positive control; the escape budget is scanned twice;transports/mllp.py_outgoing_control_idis a second MSH-10 reader.Hosted legs to read
Full pytest leg, the four mypy legs, test_security_static.