Commit graph

3584 commits

Author SHA1 Message Date
Owen
c8d6fd2430
Stop local sites attaching to another org's remote exit node
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.
2026-11-25 21:20:03 -05:00
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
98e4824b18
Require Traefik trust and a site-resource grant on the private AI gateway
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
2026-11-25 19:39:38 -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
Owen
6497e6d8cf
Reserve the dashboard host and other orgs' hosts for redirects and blueprints
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
2026-11-25 19:29:46 -05:00
Owen
734c90fa63
Scope device approval decisions to the org in the URL
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
2026-11-25 19:27:43 -05:00
Owen
c5c4880342
Only trust cached org membership that belongs to the caller
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.
2026-11-25 18:38:16 -05:00
Owen
c05efc9ce7
Merge branch 'fixes' into dev
# Conflicts:
#	server/lib/blueprints/parseDotNotation.ts
2026-11-25 18:34:38 -05:00
Owen
d0c4927b8d
Fix parsing 2026-11-25 09:51:43 -05:00
Owen
449656cea4
Stop custom roles granting actions and admin roles they do not hold 2026-11-23 10:47:02 -05:00
Owen
bbf3c0e48f
Look up resource auth info by guid only 2026-11-23 10:45:23 -05:00
Owen
a8c2b1f3a3
Only trust p-host when Traefik stamps the trust token 2026-11-23 10:44:54 -05:00
Owen
bf6d9d9c61
Block prototype pollution through Docker label keys 2026-11-23 10:43:49 -05:00
Owen
6f5bdf7870
Rebuild all clients when role changes 2026-11-23 10:38:01 -05:00
Owen
0ff83c0732
Add login branding to the integration api 2026-11-20 15:55:31 -05:00
miloschwartz
f4e27bbfb7
add migration 2026-11-20 14:36:47 -05:00
miloschwartz
fb303dae7f
Merge branch 'dev' into custom-login-css 2026-11-20 14:25:16 -05:00
Owen
00244b4f78
Handle login page with IDP across multiple orgs properly 2026-11-20 09:52:14 -05:00
Owen
a0853531aa
Fix client settings tier 2026-11-19 12:17:54 -05:00
Owen
210082dcfd
Fix api for role settings and add to integration 2026-11-19 11:24:40 -05:00
Owen
c487ea384c
Make acme load defaults
Fix #4144
2026-11-19 10:50:52 -05:00
Owen
ff2d4f08db
disable_login_org_names flag 2026-11-18 11:27:24 -05:00
Owen
7223e9d8cc
Support importing idps in the integration api 2026-11-18 11:17:43 -05:00
Owen
9c9bd6c8f5
Merge branch '1-27' into dev 2026-11-17 17:47:01 -05:00
Owen
10fd94cc11
Add migrations 2026-11-17 17:42:10 -05:00
Owen
adc862e37c
Read round trip from primary db
Some checks failed
Mirror Node Base Image (Docker Hub to GHCR) / mirror (push) Has been cancelled
2026-11-17 17:07:19 -05:00
Owen
e864d0655d
Support config on machine clients 2026-11-17 16:54:51 -05:00
miloschwartz
b0fc9e27a7
rename flag, remove idp association, and add permissions ui checkbox 2026-11-17 15:02:29 -05:00
Milo Schwartz
c162eabb9b
Merge pull request #3867 from digitalglue-software/feat/idp-session-exchange-upstream
feat(idp): add org-scoped integration endpoint to mint session for external IdP user
2026-11-17 15:01:02 -05:00
Owen
7b54a45e7f
WS gateway 2026-11-17 14:47:44 -05:00
Owen
bf71e7d4e9
Fix expiring line up with subscription 2026-11-16 15:54:51 -05:00
Owen
f95960c255
Require linked exit node on hybrid routes 2026-11-16 15:51:31 -05:00
Owen
9fa262f0af
Quiet log message for self hosted licenses 2026-11-16 15:22:17 -05:00
Owen
a8828b165a
Update pricing to match website 2026-11-16 13:57:55 -05:00
Owen Schwartz
1d07441b99
Merge pull request #4103 from antcybersec/fix/test-temp-workdir-cleanup
test: remove temp workdirs created by budget and org-cleanup tests
2026-11-16 13:37:41 -05:00
Owen
ada8465e0f
Merge branch 'website-checkout' into dev 2026-11-16 11:42:16 -05:00
Owen
1630797486
Send emails on activation and expiry for trials and cancels 2026-11-16 11:26:44 -05:00
Owen Schwartz
a4c29032b6
Merge pull request #4106 from antcybersec/fix/blueprint-pincode-leading-zero
fix(blueprints): accept 6-digit PINs with a leading zero
2026-11-16 09:54:52 -05:00
miloschwartz
b5dbfc3717
update apple models 2026-11-16 09:14:15 -05:00
Owen
6d69808fab
Handle support messages for self hosted licenses 2026-11-13 14:43:14 -05:00
Owen
351baa6bfa
Clean up license display 2026-11-13 14:26:36 -05:00
Owen
9c3f85068f
Support addons and monthly billing 2026-11-13 14:00:30 -05:00
Owen
a3bf2311a8
Support addons and monthly billing 2026-11-13 12:24:24 -05:00
Owen
8436277b13
Update comment 2026-11-13 10:27:52 -05:00
anant
d440b20666 fix(blueprints): accept 6-digit PINs with a leading zero
The resource blueprint AuthSchema typed pincode as a number between
100000 and 999999, so PINs starting with 0 ("012345", a tenth of all
valid PINs) could not be expressed, although the PIN API accepts any
^\d{6}$ string. Resource-policy blueprints had the opposite problem and
rejected an unquoted pincode: 123456. Docker labels lost leading zeros
too, because convertValue turned every digit string into a number.

Use one PincodeSchema for both: a 6-digit string, or a number in the old
range normalized to a string. convertValue leaves digit strings with a
leading zero as strings. Existing configs keep working.

Signed-off-by: anant <170962632+antcybersec@users.noreply.github.com>
2026-11-13 11:12:25 +05:30
anant
035bac38bd test: remove temp workdirs created by budget and org-cleanup tests
aiBudgetEnforcement.test.ts and deleteOrg.test.ts create a workdir with
mkdtempSync (temp SQLite DB, config and symlinks into the repo) and never
remove it, so every npm test run leaves two pangolin-* directories in the
OS temp dir. Remove the workdir in a finally block, the same way
migrationsSqlite.backup.test.ts already does. rmSync does not follow the
symlinks, so the repo's server/, test/ and node_modules/ are untouched.

Signed-off-by: anant <170962632+antcybersec@users.noreply.github.com>
2026-11-13 11:07:15 +05:30
Owen
f44f626124
Push client settings 2026-11-12 17:29:02 -05:00