From e9834f97a823ad0a60e768cc9b5820747086e19d Mon Sep 17 00:00:00 2001 From: Scott Hall Date: Mon, 23 Nov 2026 01:40:31 -0600 Subject: [PATCH 01/55] DICOM: redact a user identity's username and password from the association dumps pynetdicom's DEBUG dump of an A-ASSOCIATE-RQ, received or sent, prints a user identity's Username and Password in clear, on pynetdicom._handlers. On a first deployment at DEBUG that would write a peer's credential to the log. Both lines now keep their label and lose the value, whatever it spells. Tests plant a synthetic pair on the wire and read the formatted output, with a control that sees it unfiltered. BACKLOG #6637 item 6. --- docs/DICOM.md | 6 +- messagefoundry/transports/dicom.py | 3 + tests/test_dicom_peer_value_logs.py | 92 +++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 2 deletions(-) diff --git a/docs/DICOM.md b/docs/DICOM.md index 216154f333..6a0d169014 100644 --- a/docs/DICOM.md +++ b/docs/DICOM.md @@ -315,8 +315,10 @@ numpy**), lazily imported so a SQLite-only install and a console peek-import sta pynetdicom's non-conformant and refused value lines; its non-conformant transfer syntax and related SOP class lines, and its line naming a transfer syntax under the DICOM root that is no transfer syntax; the exception its DUL logs when a received PDU does not decode, with its traceback; pydicom's invalid value - line; and the UID and AE title fields of pynetdicom's DEBUG dumps of an association request, an - association acceptance and a DIMSE message. A dump field keeps at least these values: an empty one; a + line; the UID and AE title fields of pynetdicom's DEBUG dumps of an association request, an + association acceptance and a DIMSE message; and the username and password of a user identity in the + dump of an association request, received or sent, which are never kept. A dump field otherwise keeps at + least these values: an empty one; a conformant UID; a name in pydicom's UID dictionary, on a field that is no instance UID; and, on the AE title fields and on Their Implementation Version Name, a value that passes pynetdicom's AE title check, which an empty or all-space value does. `_kept` in `messagefoundry/transports/dicom.py` is the source of record. diff --git a/messagefoundry/transports/dicom.py b/messagefoundry/transports/dicom.py index 2f90f681a6..8f0a96cd67 100644 --- a/messagefoundry/transports/dicom.py +++ b/messagefoundry/transports/dicom.py @@ -551,6 +551,9 @@ class _Shape(NamedTuple): ) ), _Shape(re.compile(r"(?P