gotify / server

A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)
https://gotify.net
Other
11.13k stars 620 forks source link

feat: Trusted Proxies #624

Closed LaurenceJJones closed 7 months ago

LaurenceJJones commented 8 months ago

Fix #554

Added the option to configuration to allow trusted proxies, is handled the same way as every other []string

However, I had to find a workaround for unix sockets since there was no "official" way for Gin to handle these.

So in short if the request comes from unix socket then the RemoteAddr is set to 127.0.0.1 so if the user would like to trust a webserver that communicates on the socket then they would need to trust 127.0.0.1 via the new option.

By default the RemoteAddr is set to @ on unix socket requests , however, gin only allows IP's within the trusted proxies

codecov[bot] commented 8 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (d32d131) 86.89% compared to head (2953d75) 86.81%.

Files Patch % Lines
router/router.go 66.66% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #624 +/- ## ========================================== - Coverage 86.89% 86.81% -0.08% ========================================== Files 44 44 Lines 1587 1593 +6 ========================================== + Hits 1379 1383 +4 - Misses 124 125 +1 - Partials 84 85 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.