Hey there! π Thanks for taking the time to report this bug β we appreciate it!
Please keep in mind: PegaProx is developed and maintained entirely by volunteers in our free time. We do our best, but we can't work magic πͺ β please be patient, we'll get to your issue as soon as we can.
Want to help keep PegaProx alive?
- β Star the project β it's free and helps a lot!
- π Become a Sponsor β helps us dedicate more time to development
- π€ Contributing code or docs is always welcome too!
Describe the bug
utils/auth.py uses request.remote_addr directly to record session/activity
IP addresses in several places, instead of using get_client_ip()
(defined in pegaprox/utils/audit.py:217), which correctly resolves
X-Forwarded-For/X-Real-IP against the configured Trusted Proxies list.
As a result, the "Active Sessions" screen (My Profile β Active Sessions)
and the session last_ip/activity history show the reverse proxy's IP
(or the internal Docker network IP) instead of the real client IP β even
with Trusted Proxies correctly configured. Other parts of the system
(e.g. the LDAP authentication log) already use get_client_ip() correctly
and show the right IP for the very same request, confirming the
inconsistency.
Affected lines
pegaprox/utils/auth.py:
- line 543:
'ip': request.remote_addr if request else None,
- lines 592-593:
current_ip = _req.remote_addr
- line 766:
request.remote_addr passed directly into the activity-log insert
Working reference (for contrast)
pegaprox/api/auth.py lines 84-85, 265-266, 868-869 already import and use
_is_trusted_proxy from pegaprox.utils.audit correctly:
from pegaprox.utils.audit import _is_trusted_proxy
is_secure = request.is_secure or (_is_trusted_proxy(request.remote_addr) and request.headers.get('X-Forwarded-Proto') == 'https')
Suggested fix
Import get_client_ip from pegaprox.utils.audit in utils/auth.py
(same pattern already used for _is_trusted_proxy in api/auth.py) and
replace request.remote_addr with get_client_ip() at the three
affected call sites.
Steps to Reproduce
- Deploy PegaProx behind a reverse proxy (tested with Nginx Proxy Manager)
- Configure Trusted Proxies correctly (Settings β Server β Reverse Proxy)
- Log in from an external client
- Check Settings β LDAP auth log β shows correct external client IP
- Check My Profile β Active Sessions β shows the proxy/Docker-network IP
instead of the same client's real IP
Expected behavior
- Real IP address must be visible instead of internal trusted proxies
Environment
- **PegaProx Version: 0.9.13
- **Installation Method: Docker
- **OS: Ubuntu 24.04
- **Browser: Firefox 152
- **Behind Reverse Proxy? Ngnix
- UI? Modern / Corporate
Logs
[LDAP] TLS certificate verification disabled - MITM risk
[LDAP] Failed login for LDAP user 'zati@b.eclass' from 200.xxxx.xxx.xxx
[LDAP] TLS certificate verification disabled - MITM risk
[LDAP] TLS certificate verification disabled - MITM risk
Screenshots
Checklist
- [X ] I have searched existing issues to make sure this is not a duplicate
- [ X] I am using the latest version of PegaProx
Describe the bug
utils/auth.pyusesrequest.remote_addrdirectly to record session/activityIP addresses in several places, instead of using
get_client_ip()(defined in
pegaprox/utils/audit.py:217), which correctly resolvesX-Forwarded-For/X-Real-IPagainst the configured Trusted Proxies list.As a result, the "Active Sessions" screen (My Profile β Active Sessions)
and the session
last_ip/activity history show the reverse proxy's IP(or the internal Docker network IP) instead of the real client IP β even
with Trusted Proxies correctly configured. Other parts of the system
(e.g. the LDAP authentication log) already use
get_client_ip()correctlyand show the right IP for the very same request, confirming the
inconsistency.
Affected lines
pegaprox/utils/auth.py:'ip': request.remote_addr if request else None,current_ip = _req.remote_addrrequest.remote_addrpassed directly into the activity-log insertWorking reference (for contrast)
pegaprox/api/auth.pylines 84-85, 265-266, 868-869 already import and use_is_trusted_proxyfrompegaprox.utils.auditcorrectly:Suggested fix
Import
get_client_ipfrompegaprox.utils.auditinutils/auth.py(same pattern already used for
_is_trusted_proxyinapi/auth.py) andreplace
request.remote_addrwithget_client_ip()at the threeaffected call sites.
Steps to Reproduce
instead of the same client's real IP
Expected behavior
Environment
Logs
Screenshots
Checklist