Skip to content

Conversation

@riton
Copy link
Contributor

@riton riton commented Aug 14, 2025

Fixes #1014

Add support for express trust proxy and remote client IP in failed authentication logs.

@riton
Copy link
Contributor Author

riton commented Aug 14, 2025

Hi @bpatrik

This is an initial implementation of #1019
This has not been tested yet.

Feel free to comment !

Regards

@riton riton force-pushed the feature/log_remote_client_ip branch from 238ef64 to 6c8a643 Compare August 14, 2025 11:58
},
description: $localize`Should the backend trust proxies to extract remote Client IP`,
})
trustProxy: string = "false";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a boolean? then please use a bollean value (i,e: trustProxy: boolean= false;)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh I see how this works. Reading up on this: https://expressjs.com/en/guide/behind-proxies.html

This value sets the number of hops. Can you improve on that? its not clear form the name and the description what is happening.
Like: changing the config name or separating into a sub config. like: "class trustedProxyConfig {enable:boolean, trustedHop:number}"

Copy link
Contributor Author

@riton riton Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the name of the config setting is not easy to choose.

Express trust proxy accepts boolean, string or number values and each have different meaning.
My idea was to just pass through the value to epxress and allow the end user to specify the exact value type he wants.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh true. sorry I misunderstood the code (I read that by def it will convert the value to number).

In this case it looks good to me.

@bpatrik
Copy link
Owner

bpatrik commented Aug 14, 2025

generally looks good. I had some confusion about the naming. Can you improve on that?

Than you for your contribution!

@bpatrik bpatrik added this to the Next (probably v2.5) milestone Aug 14, 2025
@riton riton force-pushed the feature/log_remote_client_ip branch from 6c8a643 to 182d5d4 Compare August 14, 2025 12:55
@bpatrik bpatrik merged commit 82adb07 into bpatrik:master Aug 15, 2025
4 of 5 checks passed
@bpatrik
Copy link
Owner

bpatrik commented Aug 15, 2025

than you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Logging] Add remote IP log context on authn failure

2 participants