atna-audit #84

Merged
christof.schadt merged 25 commits from atna-audit into main 2026-11-12 08:38:20 +01:00
Owner
No description provided.
christof.schadt added this to the 26.10.0 milestone 2026-11-12 08:38:08 +01:00
Plan 43 steps 1-2 and plans 43/44 (ATNA audit trail, Audit Record
Repository). src/audit/ holds the event model, a non-blocking AuditSink,
AuditScope aggregation per study, the PS3.15 A.5 XML encoder and RFC 5424 /
5425 syslog framing. Nothing emits events yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 44 A2. src/audit/repo/ parses RFC 5424 syslog and PS3.15 A.5 audit
XML (unparsable messages are stored with parse_error, as ATNA requires),
stores records in a separate SQLite database with participants and objects
for search, and links every record to the previous one by SHA-256. Verify
reports edits and gaps; prune moves the chain anchor. Adds quick-xml 0.41,
already in the dependency tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 44 A1 and A3. [atna] carries the audit source identity and
[atna.repository] switches on the local store (default
audit/<instance>.db next to the config). run_frontend starts the audit
writer before any listener and stops it after all have closed, so
Application Start and Stop bracket the instance's work. The writer encodes
each event as the RFC 5424 message a remote ARR would receive, stores
queued events in batches, and reports dropped events as a Security Alert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 43 step 3, first part. Each C-STORE association and each STOW-RS
request yields one DICOM Instances Transferred record per study for the
caller's leg and, with a relaying backend, one for the gateway -> backend
leg, naming the caller as requestor and the fallback token when it was
presented instead of the caller's own. Patient, study and accession come
from a sparse read of the dataset header, off the association loop.

The DICOMweb auth layer now records what it verified about the caller
(validated token subject, else the client certificate CN) as a
VerifiedIdentity request extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 43 step 3, second part. Every C-FIND and QIDO-RS search yields a
Query record for the caller's leg and, when it reached a relaying backend,
for the gateway -> backend leg. C-FIND records the identifier with its
transfer syntax; QIDO-RS records the request's path and query string under
the Study Root C-FIND SOP class. FHIR Patient and ImagingStudy reads and
searches are recorded by one middleware inside the auth layer.

Parties (caller, gateway, backend, credential) is built once per
association or request and hands out both the transfer scopes and the
query records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 43 step 3, third part. Retrieves record DICOM Instances Transferred
(action R) per study on the backend -> gateway leg of a relay and on the
gateway -> recipient leg: the caller for C-GET, the move destination for
C-MOVE, the destination URL for SEND-RS. The gateway records Begin
Transferring on the leg it sends.

C-MOVE and SEND-RS are audited inside execute_push, so both delivery paths
(STOW-RS and parallel C-STORE associations) count each instance once; an
instance retried after its association broke is recorded on its final
attempt only. TransferAudit::add now takes an outcome per leg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 43 step 3, fourth part. WADO-RS retrieve and /metadata record DICOM
Instances Transferred (action R) per study as each instance or dataset is
sent; the records are complete only with the closing delimiter, so a
truncated or abandoned response is a serious failure. Bulk data, frames
and the bulk data relay record one instance per request, named by the
study in the path.

backend::track_relay tells whether an operation reached the relayed
server, so retrieve cache hits get no backend leg. Begin Transferring is
now emitted only once something of the study was actually sent. Instance
identifiers for audit are read from the first 64 KiB of a payload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 43 step 3, fifth part. DICOMweb DELETE records DICOM Instances
Accessed (D), naming the study's patient as the index knew it before the
delete. Patient corrections, merges, moves and undos from the admin UI
record Patient Record (U) for every patient involved and Instances
Accessed (U) for the studies changed, with the admin user as actor.
Datasets a pipeline's on_receive rewrote are Instances Accessed (U) and
instances a pipeline emitted are Instances Accessed (C), both with the
pipeline as actor; emitted instances also get the backend leg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 43 step 3, sixth part. Refused TLS handshakes (DICOMweb acceptor and
DIMSE) and a client certificate that does not match the token are Node
Authentication alerts; refused tokens and AE titles, allowed_callers
refusals and DICOMweb 401s are Use of Restricted Function. Peer alerts go
out at most once a minute per kind and peer, the next one saying how many
were held back. Configuration saves are Software Configuration alerts;
client onboarding, trusted backend certificates and runtime token changes
are Security Configuration alerts.

The DIMSE access check now records why it refused; AuditContext is built
with AuditContext::new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 43 step 3, last part. Admin UI logins (success and failure) and
logouts are User Authentication records naming the user and address. The
archive browser's searches are Query records, its instance views DICOM
Instances Accessed (R), its deletes Instances Accessed (D) and its sends
transfers to the chosen target, all with the actor "archive browser".

With every call site in place, the audit module's blanket allow(dead_code)
is gone; what remains unused (repository search/verify/prune, receiver
transports, RFC 5425 framing) is marked for the plan 44 and plan 43 steps
that use it. InstanceId::study_uid replaces two local helpers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan 44 A4 and A5. The audit repository verifies its newest 1000 records
at startup and deletes records older than [atna.repository] retain_days
(default 2190) once a day; a broken chain is logged and recorded as a
Security Alert. The admin UI gains an Audit page: search by time, event,
outcome, user, patient, study and source, open a record with its
participants, objects and raw message, and verify the whole chain.

Only accounts with audit_reader = true may read the log, and without
accounts nobody may. Every search, record read and verification is itself
recorded as Audit Log Used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[atna.audit] sends every audit record as syslog (ITI-20) over TLS
(RFC 5425) or UDP (RFC 5426) through a disk spool, alone or next to the
local repository. The config editor gets an Audit trail tab for [atna],
the repository and the sender; the Audit page shows the sender's state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With enforce = true the configuration is refused unless every connection
carrying patient data is mutually authenticated TLS: listeners, admin UI,
archive browser, backends, move destinations, remote FHIR and the ARR.
Each refusal names its key. A C-MOVE to the RET<port> auto-route, which
has no TLS, is refused with A801 and a Security Alert. The switch is on
the editor's Audit trail tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat: require audit_reader only under [atna] enforce
All checks were successful
CI / build-and-test (push) Successful in 17m46s
da1321b20f
Without strict mode the Audit page follows the admin UI's own access
rules: any account, or anyone on a UI without accounts. Reading is still
recorded as Audit Log Used, under the account name or "admin UI without
login".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A loopback listener behind a proxy that checks client certificates and
passes them in a header from trusted_proxies (plan 18 step 2) meets
[atna] enforce; audit records name the forwarded client. DIMSE and the
archive browser stay as they are. Not built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs: plan 43 amendment covers DIMSE over loopback
All checks were successful
CI / build-and-test (push) Successful in 3m49s
fc7dbd648f
A chained DICOMweb-to-DIMSE gateway and a TLS-terminating TCP proxy
(Traefik, HAProxy) both leave a plaintext DIMSE hop on loopback.
[atna] trust_loopback lets strict mode accept it on both sides; PROXY
protocol on the DIMSE listener restores the client IP and, where the
proxy sends it, the certificate name. Not built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chore: update file name
All checks were successful
CI / build-and-test (push) Successful in 15m48s
82255b4fb7
chore: update documentation
All checks were successful
CI / build-and-test (push) Successful in 3m33s
7873ab8d86
feat: act as Audit Record Repository
All checks were successful
CI / build-and-test (push) Successful in 5m0s
bb531ca616
christof.schadt deleted branch atna-audit 2026-11-12 08:38:20 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
IHE-RO-Tooling/dicom-gateway!84
No description provided.