Commit graph

5 commits

Author SHA1 Message Date
Owen
f44148c687
Leave local sites on remote exit nodes alone
Remote exit nodes get their Traefik config from /hybrid/traefik-config
with local sites included, and dial those targets inside the customer's
own network, where localhost targets are normal. The previous commit
applied the local-site restrictions to them too.

- createSite only checks flags.disable_local_sites, not
  traefik.site_types (SaaS has ["newt"] centrally but serves local sites
  through remote exit nodes).
- Target validation for local sites runs only when Pangolin's own Traefik
  serves the site (no exit node or a non-remote exit node), in
  createTarget, updateTarget and blueprints.
- The private Traefik config skips bad local targets only when the config
  is not for a remote exit node.
- Migration notes updated, including a query that excludes remote-node
  sites.

PAN-1885
2026-11-25 21:17:58 -05:00
Owen
721f150f6b
Add traefik.disable_http_config to turn off GET /traefik-config
Deployments where Traefik never polls the HTTP provider (file_mode edge
nodes, Kubernetes CRDs) can now switch the endpoint off instead of
managing a token.

PAN-1885
2026-11-25 21:08:15 -05:00
Owen
b6bbf36be5
Let bannedEmails ban whole domains and plus-addressed variants
bannedEmails only matched exact addresses, so an attacker on a disposable
domain kept signing up with new addresses (and "+tag" variants), and the
list was not checked at all for users provisioned through an OIDC IdP.

- bannedEmailCandidates: exact address, address without "+tag", and
  "@domain" for the domain and each parent domain (never a bare TLD).
- isEmailBanned is used by signup and by validateOidcCallback before a
  new OIDC user is created.
2026-11-25 19:50:06 -05:00
Owen
9eb421cd1b
Guard tenant-supplied outbound URLs against SSRF
AI provider upstreamUrl was only z.url() and the AI gateway streamed the
upstream response back, so any org admin could read internal services,
Pangolin's own internal API or the cloud metadata service (prod had a
provider pointed at 169.254.169.254). Alert webhooks and HTTP log
streaming fetched any URL and followed redirects.

- server/lib/outboundAddress.ts (no config dependency, unit tested):
  always refuses loopback, unspecified, link-local, broadcast, multicast
  and reserved addresses (incl. IPv4-mapped forms), localhost and
  Pangolin's own service names; refuses RFC1918/ULA/CGNAT when private
  outbound is blocked. Provides a resolver check and a connect-time DNS
  lookup so rebinding cannot get around it.
- server/lib/outboundUrlGuard.ts: policy from config. New
  flags.block_private_outbound_urls defaults to on for SaaS, off for
  self-hosted (local models).
- aiGatewayUpstreamFetch checks the host and passes the guarded lookup to
  every upstream request; create/updateAiProvider reject blocked URLs.
- sendAlertWebhook and HttpLogDestination check the URL before sending
  and no longer follow redirects.
- Migration notes cover the flag and a query for providers that will
  stop working.

PAN-1799 (3v9x, 4g5q)
2026-11-25 19:38:03 -05:00
Owen
8419370e5b
Keep tenants from publishing Pangolin's internal services via local sites
Traefik dials a local site's targets from inside Pangolin's own network, so
an org admin could create a local site with a target such as pangolin:3001
and publish the internal API (including the unauthenticated
/traefik-config, which lists every org's header values and gateway trust
tokens) on their own hostname. disable_local_sites was only read by the
dashboard; the server-side check in createSite was commented out.

- createSite refuses local sites when flags.disable_local_sites is set or
  "local" is not in traefik.site_types, and basic WireGuard sites when
  flags.disable_basic_wireguard_sites is set.
- New localSiteTargetError rejects loopback, unspecified, link-local
  (incl. 169.254.169.254), broadcast, localhost, the internal hostname,
  gerbil, traefik and badger. createTarget, updateTarget and blueprint
  targets refuse them on local sites, and both Traefik config generators
  skip existing ones.
- Optional traefik.config_token: when set, GET /traefik-config requires
  "Authorization: Bearer <token>" (constant-time compare). Unset keeps the
  old behaviour and logs a warning once. The installer now generates the
  token and writes it to config.yml and Traefik's HTTP provider headers.
- Migration notes for 1.28.0 cover the config change and a query for
  existing targets that will stop routing.

PAN-1885 / GHSA-jrw8, rx89 part of PAN-1799
2026-11-25 19:34:53 -05:00