Unset TRUSTED_PROXIES trusts the RFC 1918 ranges (closes #119) #121

Merged
clawbot merged 1 commits from issue-119-trusted-proxies-private-ranges into next 2026-10-14 13:01:35 +02:00
Collaborator

With TRUSTED_PROXIES unset, the container's nginx now takes the client address from X-Forwarded-For on requests from 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, as sneak ruled on 2026-09-22 for every app. A list replaces the three ranges; set and empty, nginx trusts no proxy. Each entry is still checked as before, and the backend inside the container still trusts only 127.0.0.1/32.

Closes #119

What the diff does not show:

  • Unset and empty differ only by ${TRUSTED_PROXIES-...} against ${TRUSTED_PROXIES:-...} in bin/entrypoint.sh. PORT just above uses :-; the comment says why this one does not.
  • The README's upaas section said an empty variable counts as unset. TRUSTED_PROXIES is now the exception: a deployment that passes it as an empty value gets no trusted proxy.
  • The Docker bridge gateway (172.17.0.1) is inside 172.16.0.0/12, so by default a client that reaches a published port through Docker's port proxy can write its own X-Forwarded-For. The README keeps that warning and now says the default includes the gateway.

Not covered by a test: the repo has no test of the entrypoint or of nginx, so the check was by hand, running the image built from this branch with requests from the host.

Model: opus-5-5

With `TRUSTED_PROXIES` unset, the container's nginx now takes the client address from `X-Forwarded-For` on requests from `10.0.0.0/8`, `172.16.0.0/12` and `192.168.0.0/16`, as sneak ruled on 2026-09-22 for every app. A list replaces the three ranges; set and empty, nginx trusts no proxy. Each entry is still checked as before, and the backend inside the container still trusts only `127.0.0.1/32`. Closes https://git.eeqj.de/sneak/netwatch/issues/119 What the diff does not show: - Unset and empty differ only by `${TRUSTED_PROXIES-...}` against `${TRUSTED_PROXIES:-...}` in `bin/entrypoint.sh`. `PORT` just above uses `:-`; the comment says why this one does not. - The README's upaas section said an empty variable counts as unset. `TRUSTED_PROXIES` is now the exception: a deployment that passes it as an empty value gets no trusted proxy. - The Docker bridge gateway (`172.17.0.1`) is inside `172.16.0.0/12`, so by default a client that reaches a published port through Docker's port proxy can write its own `X-Forwarded-For`. The README keeps that warning and now says the default includes the gateway. Not covered by a test: the repo has no test of the entrypoint or of nginx, so the check was by hand, running the image built from this branch with requests from the host. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 10:50:41 +02:00
clawbot self-assigned this 2026-10-14 10:50:41 +02:00
Author
Collaborator

PASS: this meets #119 and is ready to merge into next.

Model: opus-5-5

PASS: this meets https://git.eeqj.de/sneak/netwatch/issues/119 and is ready to merge into `next`. Model: opus-5-5
clawbot added needs-rebase and removed needs-review labels 2026-10-14 12:02:20 +02:00
clawbot force-pushed issue-119-trusted-proxies-private-ranges from 47b5ccd682 to d568153af0 2026-10-14 12:06:42 +02:00 Compare
clawbot added needs-review and removed needs-rebase labels 2026-10-14 12:13:10 +02:00
Author
Collaborator

PASS: this meets #119, and its only conflict with current next is in the Completed Steps of TODO.md, where this entry goes above the one for #124.

Model: opus-5-5

PASS: this meets https://git.eeqj.de/sneak/netwatch/issues/119, and its only conflict with current `next` is in the Completed Steps of `TODO.md`, where this entry goes above the one for https://git.eeqj.de/sneak/netwatch/issues/124. Model: opus-5-5
clawbot added 1 commit 2026-10-14 12:48:54 +02:00
With TRUSTED_PROXIES unset, bin/entrypoint.sh gives nginx one
set_real_ip_from line for each of 10.0.0.0/8, 172.16.0.0/12 and
192.168.0.0/16, as sneak ruled on 2026-09-22 for every app. A list
replaces them, and set and empty trusts no proxy; each entry is checked
as before. The backend inside the container still trusts only
127.0.0.1/32. README.md, configs/nginx.conf and the comment in
script/frontend-viewport-test say the new default.

Model: opus-5-5
clawbot force-pushed issue-119-trusted-proxies-private-ranges from d568153af0 to f43cd9f5a0 2026-10-14 12:48:54 +02:00 Compare
clawbot merged commit cbcde098dc into next 2026-10-14 13:01:35 +02:00
clawbot deleted branch issue-119-trusted-proxies-private-ranges 2026-10-14 13:01:36 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/netwatch#121