Commit graph

305 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
miloschwartz
f4e27bbfb7
add migration 2026-11-20 14:36:47 -05:00
Owen
10fd94cc11
Add migrations 2026-11-17 17:42:10 -05:00
Owen
ec0370f0b8
Add badger 1.8.0 update to migrations 2026-11-03 10:40:36 -05:00
miloschwartz
8538fff0ef
store metadata on session 2026-11-03 09:56:56 -05:00
Owen
a4cc0fb8f7
Fill in autoProvision 2026-11-02 16:28:12 -05:00
Owen
d0b84edb3d
Fix formatting 2026-11-02 16:16:45 -05:00
Owen
bb47ba56f2
Complete 1.26 migration 2026-11-02 16:12:49 -05:00
Owen
4726cb4fc1
Support matching on the base wildcard resources 2026-11-02 15:30:16 -05:00
Owen
5b8833f302
SSH log 2026-11-02 14:56:55 -05:00
miloschwartz
36f36d2ca1
address review feedback 2026-10-30 10:56:47 -04:00
Severin Enzler
7176fa4a40 Revalidate OIDC sessions with the IdP using refresh tokens
Pangolin consults the IdP only at login and keeps its own session
afterwards, so disabling a user or revoking their sessions in the IdP
does not end their Pangolin sessions.

Store the IdP refresh token at OIDC login as a grant and redeem it at
most every server.idp_session_revalidation_minutes (default 5). If the
IdP rejects it with invalid_grant, the grant is marked revoked and all
sessions backed by it and their resource sessions are deleted. Other
errors (IdP unreachable or slower than 10 seconds, invalid_client after
a secret change) keep the sessions valid and are retried after at most
a minute instead of on every request.

Only the instance holding a lease on the grant in the primary database
redeems its refresh token, and it writes the result only while it still
holds the lease, so instances never redeem the same token concurrently.
The per-request lookup reads from a replica through safeRead.

Device logins of the Pangolin clients share the grant of the browser
session that approved them, read from the primary database, so a rotated
refresh token is never redeemed twice by separate sessions.

The Entra ID provider type hardcodes its scopes, so it now requests
offline_access to get a refresh token.
2026-10-29 11:33:30 +01:00
Owen
bd38b71b4d
Add 1.25.3 migrations 2026-10-23 09:48:09 -04:00
Owen
d60219ae89
Cant update badger yet 2026-10-21 15:18:18 -04:00
Owen
f4140fd6f6
Add mtls to blueprint, policy, and oss getTraefikConfig 2026-10-20 10:02:44 -04:00
Owen
702719ed76
Add badger to migration 2026-10-19 17:15:22 -04:00
Owen
65571d8eeb
Relay port must have default value 2026-10-19 11:23:06 -04:00
Owen
4555ef8da8
Add 1.25 migrations 2026-10-19 11:16:36 -04:00
TiltedTeapot
3712921048 Propogated Changes. listen port is now accessed from db instead of config 2026-10-06 18:21:05 -06:00
Owen
97e0c19276
Add migrations 2026-09-28 20:39:38 -04:00
Tyagiquamar
b74ded3a9c
fix(sqlite): tag per-migration database backups with version and prevent collisions 2026-09-18 21:31:00 +05:30
Tyagiquamar
803fbb2ea2
fix(sqlite): take a single database backup per upgrade instead of one per migration 2026-09-17 22:45:42 +05:30
Owen
735787b183
Fix #3778 2026-09-16 10:11:20 -04:00
Owen
4716a2a647
Make migration idempotent
Ref #3759
2026-09-16 09:08:20 -04:00
Hayyan Hajwani
9298ec7cdb fix(setup): correct month index and zero-pad database backup file names
Backup names were built inline from Date#getMonth, which is zero-indexed, so a
backup taken on 12 September 2026 was written as db_2026-8-12_20-35-56.sqlite.
No field was zero-padded either, giving names like db_2026-8-12_20-36-2.sqlite.

Extract formatBackupTimestamp into server/lib and use it from both places that
built the string: the backupDb helper in migrationsSqlite.ts and the inline copy
in the 1.0.0-beta9 setup script. Padding every field also makes the names sort
lexicographically in the order the backups were taken.

Adds tests covering both reported names, single-digit padding and sort order.
Reverting the helper to the old formula fails them with the exact name from the
report.
2026-09-16 13:46:57 +05:30
miloschwartz
3cb41211ee
fix premature migration execution 2026-09-15 20:44:17 -04:00
miloschwartz
8f1344a665
bump version and add 1.23 migrations 2026-09-14 17:18:31 -04:00
Owen
a874a0b745
Add explicit process exit to prevent hanging in migrations script 2026-09-14 16:48:10 -04:00
Owen
be0dd65557
Update imports 2026-09-03 11:35:28 -04:00
miloschwartz
a47a68d8e1
update badger version 2026-08-27 11:40:46 -04:00
Owen
331fee24d4
Make the default session storage 0 2026-08-26 11:02:39 -04:00
Owen
72d2c79793
Add migration for streaming table 2026-08-25 10:42:56 -04:00
miloschwartz
a7bbafd2f0
bump badger version 2026-08-19 12:01:01 -04:00
Owen
6824ec6e3e
Clean up empty execute in migration 2026-08-19 11:51:12 -04:00
Owen
dc8e724482
Fix issue with subnets in migrations 2026-08-19 09:30:02 -04:00
Owen
1bb4f604e9
Fix select from missing new columns 2026-08-18 09:52:24 -04:00
Owen
aa8d339d35
Adjust sudo mode on the roles to full for use of ssh 2026-08-17 17:24:16 -04:00
Owen
7d10b63dc5
Add v1 migrations 2026-08-17 16:50:51 -04:00
Owen
92916cd9db
Remove wrong named 1.21.1 migration for 1.22 2026-08-17 16:01:30 -04:00
Owen
075d112861
Add base migrations 2026-08-17 15:54:42 -04:00
miloschwartz
4048fa274a
fix non admins cant see private resources details in launcher 2026-08-06 12:32:19 -04:00
miloschwartz
a0b9ea76a3
add badger to migration 2026-07-17 16:22:15 -04:00
miloschwartz
eb3a3eac98
add 1.21 migrations 2026-07-17 15:58:13 -04:00
miloschwartz
4dcf684868
add 1.20.0 migration 2026-07-07 16:04:41 -04:00
Owen
8f377a4fb2
Dont run on cloud 2026-07-01 22:07:33 -04:00
Owen
108cb6216c
Add migration to fix policy delete issues
Ref #3257
2026-07-01 10:39:41 -04:00