mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
fix(egress): keep loopback grantable under an exact operator origin
A Nightscout self-host on host networking with NIGHTSCOUT_PRIVATE_ORIGINS=http://localhost:1337 worked before and must keep working unchanged; an operator who lists an exact loopback origin with its port has made the same deliberate decision as one who lists a LAN origin. The never-grantable floor is now the unspecified address, link-local and the metadata endpoint only. Loopback (127/8, ::1, localhost) is grantable when listed exactly, still resolved and pinned at connect time with redirects forbidden, and still refused when not listed. ::1 is answered before the embedded-IPv4 unwrap, which read it as the IPv4-compatible spelling of 0.0.0.1 and refused it as unspecified. The pinned Nightscout transport test runs the real floor again. Each refused range keeps its own test; loopback moves to the grantable-when-listed set with a test that an unlisted loopback is still refused, and a Nightscout grant of http://localhost:1337 is asserted to parse. Refs #947
This commit is contained in:
1 parent
9c306f04e7
commit
94bed12edc
31 files changed
+236
-156
No files matched your search
@@ -28,10 +28,10 @@ Each entry is an exact normalized `scheme://host:port` trust unit:
|
||||
rejected;
|
||||
- approving one hostname does not approve subdomains, sibling hosts, or a
|
||||
different port; and
|
||||
- loopback (`127.0.0.0/8`, `::1`, `localhost`), the unspecified address,
|
||||
link-local and the cloud-metadata range cannot be listed, and a listed
|
||||
name that resolves there is refused at connect time — the grant opens
|
||||
your network, never the container or the host it runs on; and
|
||||
- the unspecified address, link-local and the cloud-metadata range cannot
|
||||
be listed, and a listed name that resolves there is refused at connect
|
||||
time; loopback (`http://localhost:1337`, `http://127.0.0.1:1337`) stays a
|
||||
valid grant for a host-networking deployment, exactly as before; and
|
||||
- any malformed non-empty entry fails evaluation instead of silently
|
||||
weakening the configured policy.
|
||||
|
||||
|
||||
@@ -235,14 +235,14 @@ Each entry is one `scheme://host[:port]`, the same grammar as
|
||||
a range grant would let a DNS rebinding to any address in the range pass
|
||||
the pin, so an operator with several relays lists several origins;
|
||||
- listing a host does not list its sub-hosts or sibling ports;
|
||||
- loopback (`127.0.0.0/8`, `::1`, `localhost`), the unspecified address,
|
||||
link-local and the cloud-metadata range (`169.254.0.0/16`, `fe80::/10`)
|
||||
cannot be granted: a literal entry is logged once and ignored, and a
|
||||
listed name that resolves there is refused at dial time. On a
|
||||
host-network deployment, list the LAN address of the relay instead of
|
||||
`localhost`;
|
||||
- RFC1918, IPv6 unique-local and CGNAT (a Tailscale address or MagicDNS
|
||||
name) are what the list is for;
|
||||
- the unspecified address (`0.0.0.0`, `::`), link-local and the
|
||||
cloud-metadata range (`169.254.0.0/16`, `fe80::/10`) cannot be granted: a
|
||||
literal entry is logged once and ignored, and a listed name that resolves
|
||||
there is refused at dial time;
|
||||
- RFC1918, IPv6 unique-local, CGNAT (a Tailscale address or MagicDNS name)
|
||||
and, on a host-network deployment, loopback (`http://127.0.0.1:8080`,
|
||||
`http://localhost:8080`, `::1`) are what the list is for — an exact
|
||||
loopback origin with its port is as deliberate a decision as a LAN one;
|
||||
- a malformed entry is logged once at first use and grants nothing; the
|
||||
valid entries beside it keep working.
|
||||
|
||||
@@ -261,11 +261,13 @@ What is refused where, so you know which lever to pull:
|
||||
| `gotify.lan`, `gotify.home.arpa`, a Docker service name | refused at send | works |
|
||||
| `gotify.local` (mDNS) | refused at save | allowed, if the container resolves mDNS |
|
||||
| Literal `192.168.x.x`, `10.x.x.x`, `100.64.x.x`, `fd00::/8` | refused at save | works |
|
||||
| `localhost`, `127.0.0.1`, `169.254.169.254`, `::1` | refused at save | still refused (`private_origin_not_grantable`) |
|
||||
| `localhost`, `127.0.0.1`, `::1` (host networking) | refused at save | works |
|
||||
| `0.0.0.0`, `169.254.169.254`, `fe80::…` | refused at save | still refused (`private_origin_not_grantable`) |
|
||||
|
||||
A private target that is not listed is refused when the card is saved
|
||||
(`422`, `meta.errorCode` = `private_origin_not_approved`, the message
|
||||
names the variable) or, for a DNS name the save cannot classify, when the
|
||||
names the variable; a link-local, metadata or unspecified target answers
|
||||
`private_origin_not_grantable` instead, because no grant can open it) or, for a DNS name the save cannot classify, when the
|
||||
test button or a reminder dials it. The resolved address is never shown
|
||||
to the user. Telegram, email and Web Push are not affected: their hosts
|
||||
are not user-supplied.
|
||||
|
||||
Reference in new issue
Block a user