When a destination rate-limits part-way through a backlog, events are
still being delivered, but every cycle counted as another consecutive
failure. Back-off grew to 30 minutes and, after 24 hours, the rest of the
backlog was dropped even though the destination was reachable.
Track whether the cursor moved during a cycle and, if it did, restart
back-off from the first step instead of escalating.
With the json_single format (required for Discord webhooks) each event in
a batch is posted separately. When the endpoint rate-limited a request
part-way through, the whole batch failed and the cursor stayed put, so the
next retry resent every event that had already been accepted, hit the rate
limit again, and never made progress.
- HttpLogDestination throws a PartialDeliveryError carrying how many events
were accepted; the manager advances the cursor past them before backing off.
- HTTP 429 responses with a Retry-After of up to 10s are waited out and
retried in place (up to 3 times) instead of failing the batch.
Fixes#4128
Event-streaming body templates only expanded {{data}} as a raw JSON
object, so a single field could not be put inside a quoted string.
Endpoints such as Discord webhooks need plain strings in places like
embed field values, and quoting {{data}} produced invalid JSON that was
then sent as one JSON string, which Discord rejects.
Templates now also accept {{<field>}} for any top-level field of the
event's data (for example {{orgId}} or {{path}}), as alert-rule
webhooks already do. Values are JSON-escaped so they are safe inside
quotes; null renders as empty text. {{event}}, {{timestamp}} and {{data}}
keep their meaning, including for request logs, whose rows have their
own timestamp column. Placeholders are expanded in one pass so values
are never expanded again, and unknown placeholders are left as-is.
The destination form explains the placeholders.
Fixes#4129
createSite stored any exitNodeId for a local site without checking that
the org may use that exit node, and the hybrid Traefik config served every
site on the node regardless of org. An org admin could attach a local site
to another customer's remote exit node (ids are sequential) and have that
node proxy a hostname of theirs into the customer's network.
- createSite runs verifyExitNodeOrgAccess for local sites with an exit
node, same as tunnelled sites.
- The private Traefik config for a remote exit node only includes sites of
orgs linked to that node. Nodes with no org links keep the old
behaviour, so the 9 existing local sites on unlinked nodes keep routing.
Found while reviewing the PAN-1885 change; no evidence on prod of a local
site on a node linked to a different org.
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
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
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.
The private (site-resource) AI gateway path never required the trust
header, took the caller's identity from X-Pangolin-Client-Ip without
proof it came from Traefik, and never checked that the caller was granted
the site resource. A client of any org on a shared exit node (or anything
reaching the gateway port) could use another org's inference resource and
spend its provider keys, or pose as another user for budgets.
- Every gateway request must carry a valid trust header. Traefik stamps
it on both the public inference router and the site-resource router.
- The client IP header is only read when the trust header is valid and
server.enable_ai_gateway_client_ip_header is on (Badger overwrites it);
otherwise req.ip is used.
- Site-resource requests need a resolved user who is a member of the
owning org and granted the site resource (canUserAccessSiteResource),
else 403.
PAN-1801 / GHSA-crpc, PAN-1802 / GHSA-mwjq
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)
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
Redirects are answered before auth and outrank resource routers, but
createRedirect/updateRedirect only checked that the org held the domain.
Any org admin could put a redirect on another org's resource host or on
the dashboard host (the config-managed wildcard domain is linked to every
org) and receive its traffic, including p_token and share links.
Blueprints also skipped the dashboard-host and login-page checks that
createResource has.
- server/lib/reservedHosts.ts: checkReservedHost (dashboard host and login
page domains, wildcard-aware, including matchBaseDomain) and
checkRedirectHostAvailable (also rejects another org's resource or
redirect on the same host; same-org resources stay allowed).
- createRedirect/updateRedirect call checkRedirectHostAvailable.
- createResource, updateResource and the blueprint getDomain call
checkReservedHost, replacing the inline exact-match checks.
PAN-1850 / GHSA-8545 (dup GHSA-9j9g, GHSA-crh2), PAN-1813
processPendingApproval looked the approval up by id alone (the org join
compared approvals.orgId with itself), so an admin of any licensed org
could approve or deny another org's pending device approval. The lookup,
the approval update and the client update are now all filtered on the
org from the path; a cross-org id returns 404.
PAN-1886 / GHSA-jvg3
Access middlewares cache the caller's org link on req.userOrg and
req.apiKeyOrg and skip their membership query when it is already set.
A value inherited from a polluted Object.prototype passed that check.
- Give every request its own undefined copy of the cached auth fields
(userOrg, apiKeyOrg, userOrgRoleIds, userOrgId, userOrgIds,
orgPolicyAllowed) before any route runs, on the API, integration,
internal and AI gateway servers.
- Add ownUserOrg/ownApiKeyOrg, which return a cached value only if it is
an own property for the signed-in user or calling key.
- Every user and API key access middleware now uses them and refuses
when the cached org does not match the org of the object being
accessed. verifyApiKeySiteAccess and verifyApiKeySiteResourceAccess
had no org comparison at all once req.apiKeyOrg was set.
Defence in depth for PAN-1814 / GHSA-5fhj.