Skip to content

v4.1.0

Latest

Choose a tag to compare

@azoner azoner released this 06 Nov 18:43
· 3 commits to master since this release
b6c9e09

Hostile X12 input can no longer forge acknowledgement segments, inject script into the HTML report, or leak data values into logs. Install with pip install pyx12==4.1.0. Same code as 4.1.0rc1. Three caller-visible changes are listed under Breaking changes; read those before upgrading a production worker.

Breaking changes

  • X12Writer.Write now raises EngineError when an element value contains one of the writer's own delimiters (segment, element, sub-element or repetition separator). Previously the value was written as-is and produced corrupt X12. Affects callers that build segments with one set of delimiters and write with another, including xmlx12_simple and the examples. (#208)

  • Reading a file whose segment has no terminator within 1 MiB now raises X12Error from x12n_document (and the CLI scripts) instead of silently stopping at that segment. (#211)

  • Log records on the pyx12 logger no longer include the error message or the offending data value; each is now Line:N LEVEL:code refdes. Opt back in with param.set("log_data_values", True), err_handler(log_data_values=True) or x12valid --log-data-values. Anything parsing pyx12 log lines sees the new shape. (#214)

Acknowledgement output changes

  • Values copied from the input into a 997/999 ack (IK4-04 / AK4-04, IK3-01 / AK3-01, envelope ids) have ~ * : ^, control characters and non-ASCII replaced with ?; IK4-04 / AK4-04 are capped at 99 characters. Previously a hostile value could forge ack segments. (#208)

Fixes

  • pyx12.errh_xml.err_handler() with no output path now deletes its temp report when the handler is collected or the process exits, and the no-argument form works again (it opened the file in binary mode and raised TypeError on first write). (#215)
  • A single segment longer than about 8 KB no longer silently ends the file; every following segment is read. (#211)
  • x12xml output replaces control characters in data with ? so the document is always well-formed XML. (#211)
  • The HTML error report escapes error text and segment ids, so a hostile data value or segment id can no longer inject markup or script into the report. (#209)

Deprecated

  • pyx12.errh_xml warns on import and will be removed in 5.0. Use pyx12.errh_json or the fd_json output of x12n_document. (#215)

Project

  • CI and release workflows pin every GitHub Action to a commit SHA, run with a read-only token, and get weekly Dependabot bump PRs. (#210)

Full changelog: v4.0.1...v4.1.0