Record the socket peer address in audit events #600
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.36) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 201 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.318
Real PR Conversation Timeline
1 comments
"Review active on #600"
general
weight: 0.35
mgaffigan
Fixes #578
MirthServlet.getRequestIpAddress()returned theX-Forwarded-Forheader verbatim whenever a client sent one, so any client could choose the source IP stored on login, authorization and message-access events. It now returnsrequest.getRemoteAddr(), which was already the fallback. This is the first item of the issue's suggested fix.It also closes a second problem the issue doesn't mention.
EVENT.IP_ADDRESSisVARCHAR(40)andDefaultEventController.insertEventlogs insert failures without rethrowing them. From reading that code, a header longer than 40 characters would fail the insert and lose the event. I did not reproduce this against a database.Behavior change
Behind a reverse proxy, events now record the proxy's address instead of the client's. Events are unchanged for clients that connect directly without sending the header.
I left out the trusted-proxy setting the issue proposes, so this PR adds no configuration. If reviewers need proxy support before this merges, I can add it here.
How to verify
./gradlew :server:test --tests '*MirthServletTest'. The new test,getRequestIpAddressIgnoresForwardedForHeader, fails without the change and passes with it.X-Forwarded-For: 10.0.0.5header and check the IP address on the Login event.I ran the server unit tests on Windows. 876 ran and 11 failed, all in
DICOMSerializerTestandNCPDPSerializerTest. The same 11 fail onmainat 8e5e63da3 without this change. I did not run the live login check.🤖 Generated with Claude Code