Commit graph

119 commits

Author SHA1 Message Date
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
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
ff2d4f08db
disable_login_org_names flag 2026-11-18 11:27:24 -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
26082712c6
Jit mode default false
Ref #3262
Ref #3793
Ref #4072
2026-11-09 16:23:48 -05:00
miloschwartz
ddc4934ab8
make session revalidation private 2026-11-03 16:49:26 -05:00
gk1
34a0c1e630 feat(idp): root-gated create-session for an external IdP user (per review)
Reworks the org-scoped exchange-token endpoint into a root-gated create-session route,
addressing the review on the earlier version:

- Requires a ROOT API key holding the createIdpSession action, not an org-scoped key.
  Minting a session is impersonation, so it is deliberately root-only.
- Gated behind flags.enable_idp_create_session (off by default, self-hosted only;
  refused when build === "saas").
- Drops orgId entirely: the user must belong to the identity provider, not an
  organization. The route becomes /idp/:idpId/oidc/create-session.

Removes the now-unused org-scoped createSessionForIdpUser helper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-30 16:55:25 -07:00
Milo Schwartz
9115808301
Merge pull request #4027 from S-NoF3aR/feature/idp-session-revalidation
Revalidate OIDC sessions with the IdP using refresh tokens
2026-10-30 14:44:23 -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
8ce036b413
Clean up config for dns servers 2026-10-28 15:51:08 -04:00
Owen
3090c74131
Fix pg migration import 2026-10-20 16:31:52 -04:00
Owen
ee8724f117
Move the offline intervals to the regular config 2026-10-20 12:15:46 -04:00
Fra146
7ad56a8bae Add config options and badger options injection 2026-09-24 11:42:05 +02:00
Owen
29d93a574b
Fix optional() type errors 2026-09-23 14:48:05 -04:00
Owen
6ec37220d6
Remove default from server
Fixes #3804
2026-09-23 10:33:49 -04:00
Owen
c6c12f1dcb
Support _FILE env vars
Closes https://github.com/fosrl/docs-v2/issues/141
2026-09-15 10:56:39 -04:00
Owen
c11bbe670f
Remove optional() where unneeded for zod 4 2026-09-15 10:23:37 -04:00
Owen
8a97ed5200
Move domain information to all in private 2026-09-14 16:48:10 -04:00
Owen
ba2eb87f20
Widen subnet 2026-09-14 16:48:07 -04:00
Owen
9d19195089
Configurable tab title and disable flag for keys 2026-09-04 09:20:20 -04:00
Owen
be0dd65557
Update imports 2026-09-03 11:35:28 -04:00
Owen
2e87927b83
Remove unused use_subdomain 2026-08-21 10:21:21 -04:00
Owen
114592add8
Show a warning if the logs are disabled to reduce confusion 2026-08-19 16:16:05 -04:00
Owen
58195b5959
Move the acme cert sync 2026-08-17 12:00:12 -04:00
Owen
7291628f86
optionally stamp ip header for downstream use 2026-08-13 09:14:37 -04:00
Owen
cc58e28e54
Allow merging a catalog file with the api response 2026-08-12 16:06:12 -04:00
Owen
653dd920ad
Allow remote header overrides and fix display issues with log 2026-08-12 15:54:22 -04:00
Owen
fe5831eb48
pull the models from the upstream server 2026-08-10 09:57:00 -04:00
Owen
aad26b9ae4
move the ai gateway to its own server 2026-08-04 17:08:59 -04:00
Owen
80dcdfe251
change override to work for bother badger and ai gateway 2026-08-04 17:08:59 -04:00
Owen
efd2792197
bump default rate limit 2026-08-03 17:57:36 -04:00
Owen
7f2b3eb481
Move rate linmit to file 2026-08-03 14:34:11 -04:00
Owen
e9d424eb80
Move jit mode to a config param
Ref #3262
2026-07-07 10:41:12 -04:00
Owen
757bb39622
Support overriding badger for testing 2026-03-28 21:24:13 -07:00
Owen
dae169540b
Fix defaults for orgs 2026-03-02 16:49:17 -08:00
Owen
b622aca221
Try to route logs requests to a different database 2026-02-20 17:20:01 -08:00
miloschwartz
ceb359d614
refactor is licensed and subscribed util functions 2026-02-11 10:06:54 -08:00
Owen
bf5dd3b0a1
Pull secrets from env vars 2026-02-02 21:39:18 -08:00
miloschwartz
074ee70025
add flag to disable product help banners 2025-12-23 13:33:24 -05:00
Owen
5c67a1cb12
Format 2025-12-22 16:28:41 -05:00
Owen
6a5939599c
Remove maintence mode internal vars and use server 2025-12-20 17:28:39 -05:00
Pallavi Kumari
d82535d3e1 point the resource to the nextjs server for maintenance screen 2025-12-20 16:35:16 -05:00
Owen
800bdcb277 generate traefik config for maintenance ui 2025-12-20 16:35:16 -05:00
Thomas Wilde
4f154d212e
Add ASN-based resource rule matching
- Add MaxMind ASN database integration
- Implement ASN lookup and matching in resource rule verification
- Add curated list of 100+ major ASNs (cloud, ISP, CDN, mobile carriers)
- Add ASN dropdown selector in resource rules UI with search functionality
- Support custom ASN input for unlisted ASNs
- Add 'ALL ASNs' special case handling (AS0)
- Cache ASN lookups with 5-minute TTL for performance
- Update validation schemas to support ASN match type

This allows administrators to create resource access rules based on
Autonomous System Numbers, similar to existing country-based rules.
Useful for restricting access by ISP, cloud provider, or mobile carrier.
2025-12-20 12:16:31 -05:00
Owen
fea4d43920
Make utility subnet configurable 2025-12-19 14:45:00 -05:00
Owen
f9b03943c3
Format all files 2025-12-09 10:56:14 -05:00
miloschwartz
357f297a3e
remove enable_clients flag from config 2025-12-03 15:02:39 -05:00
Owen
a623604e96
Improve holepunching 2025-12-01 13:54:30 -05:00