Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVENT.IP_ADDRESS does not hold some addresses and do crash #6136

Open
FoSoFix opened this issue Mar 19, 2024 · 5 comments
Open

EVENT.IP_ADDRESS does not hold some addresses and do crash #6136

FoSoFix opened this issue Mar 19, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@FoSoFix
Copy link

FoSoFix commented Mar 19, 2024

for some reason my issue raised with a value of 50
image

while the maximum lenght is coded as 40 as seems in

IP_ADDRESS VARCHAR(40),

I did fix the Oracle with
ALTER TABLE MIRTH.EVENT MODIFY IP_ADDRESS VARCHAR2(120);

then the saved value results to be a triple private ipv4 as follows
10.56.111.229:53709, 10.190.160.116, 10.188.160.68

@FoSoFix FoSoFix added the enhancement New feature or request label Mar 19, 2024
@pacmano1
Copy link
Collaborator

That a multihomed mirth engine with all those IPs?

@ab-mg-23
Copy link

ab-mg-23 commented Mar 19, 2024

If there's an X-Forwarded-For header on messages that hit the Mirth API endpoint it uses that for the IP_ADDRESS.

protected String getRequestIpAddress() {
String address = request.getHeader("x-forwarded-for");
if (address == null) {
address = request.getRemoteAddr();
}
return address;
}

@pacmano1
Copy link
Collaborator

pacmano1 commented Mar 19, 2024

Interesting @ab-mg-23 , why all three then? Meaing I would expect the single IP.

@ab-mg-23
Copy link

ab-mg-23 commented Mar 19, 2024

Client address and two pass through proxies.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For

@jonbartels
Copy link
Contributor

jonbartels commented Mar 19, 2024

/Users/jonathan.bartels/Projects/connect/server/dbconf
./oracle/oracle-database.sql:	IP_ADDRESS VARCHAR(40),
./derby/derby-database.sql:	IP_ADDRESS VARCHAR(40),
./deltas/mysql-7-8.sql:	IP_ADDRESS VARCHAR(40)) ENGINE=InnoDB
./deltas/postgres-7-8.sql:	IP_ADDRESS VARCHAR(40))
./deltas/derby-7-8.sql:	IP_ADDRESS VARCHAR(40))
./deltas/sqlserver-7-8.sql:	IP_ADDRESS VARCHAR(40))
./deltas/oracle-7-8.sql:	IP_ADDRESS VARCHAR(40))
./postgres/postgres-database.sql:	IP_ADDRESS VARCHAR(40),
./mysql/mysql-database.sql:	IP_ADDRESS VARCHAR(40),

This would affect all DB engines and is not Oracle specific. Increasing the column the size to ~120 characters is a good workaround. 120 chars should have room for three IPv6 addresses and any separator characters.

I think the correct solution would be to properly parse the X-Forwarded-For header and store the first IP address in the comma separated list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants