Commit graph

9227 commits

Author SHA1 Message Date
Owen Schwartz
9853187dc2
Merge pull request #4113 from MauryaQbit/fix/4110-ai-gateway-relay-headers
fix(ai-gateway): relay Retry-After, rate-limit, and request-id headers
2026-12-01 09:33:10 -05:00
Owen Schwartz
1a4296fc2b
Merge pull request #4205 from fosrl/dev
1.27.2
2026-11-30 15:40:05 -05:00
Owen
6143adb487
Fix test 2026-11-30 15:39:17 -05:00
Owen
35acc6a7d9
Sanitize hook link 2026-11-30 15:19:38 -05:00
Owen Schwartz
cbbfb130e7
Merge pull request #4177 from vaibhavdabas16/fix/installer-crowdsec-keep-acme-challenge
fix(installer): keep ACME resolver settings when adding CrowdSec
2026-11-30 15:08:02 -05:00
Owen Schwartz
fa0f9449f5
Merge pull request #4184 from vaibhavdabas16/fix/log-streaming-template-fields
fix(log-streaming): allow single data fields in HTTP body templates
2026-11-30 15:06:12 -05:00
Owen Schwartz
3971cf50f4
Merge pull request #4203 from fosrl/dependabot/github_actions/github-actions-dependencies-efaa8e5e24
Bump the github-actions-dependencies group across 1 directory with 2 updates
2026-11-30 15:05:47 -05:00
Owen Schwartz
52f7987d44
Merge pull request #4204 from fosrl/dependabot/npm_and_yarn/npm-dependencies-0a1842e115
Bump the npm-dependencies group across 1 directory with 18 updates
2026-11-30 15:04:20 -05:00
Owen Schwartz
242ceff8ba
Merge pull request #4173 from vaibhavdabas16/fix/log-streaming-partial-delivery
fix(log-streaming): don't resend delivered events after a partial failure
2026-11-30 15:03:18 -05:00
Owen Schwartz
17a094b08c
Merge pull request #4198 from Tosko4/feat/migration-backup-retention
feat(setup): optional retention for SQLite migration backups
2026-11-30 14:59:15 -05:00
Owen Schwartz
3b85f1b92b
Merge pull request #4202 from pcbeingused33/fix/4200-expired-certs
fix: do not return expired certificates from domain lookup
2026-11-30 14:59:03 -05:00
Owen
08fbe9d98f
Use a .invalid host instead of a public IP in HttpLogDestination test 2026-11-30 14:57:13 -05:00
Owen
93c446505e
Convert HttpLogDestination template test to node:test 2026-11-30 14:55:05 -05:00
Owen
bdead44f00
Merge remote-tracking branch 'origin/dev' into pr-4184 2026-11-30 14:54:06 -05:00
Owen
0d3bb1440b
Convert HttpLogDestination test to node:test 2026-11-30 14:54:00 -05:00
Owen
e94329f8eb
Merge remote-tracking branch 'origin/dev' into pr-4173 2026-11-30 14:52:55 -05:00
Owen
703d7167c7
Run certificates test against the dev database with node:test 2026-11-30 14:52:47 -05:00
Owen
e713b5201b
Merge remote-tracking branch 'origin/dev' into pr-4202 2026-11-30 14:51:41 -05:00
Owen
6e20234974
Convert backupRetention test to node:test 2026-11-30 14:51:28 -05:00
Owen
d1e94fc4db
Merge remote-tracking branch 'origin/dev' into pr-4198 2026-11-30 14:50:51 -05:00
Owen Schwartz
36b574a500
Merge pull request #4194 from pcbeingused33/fix/4192-pg-startup-db-unreachable
fix(setup): exit when PostgreSQL is unreachable at startup
2026-11-30 14:34:38 -05:00
Owen
668aaefb35
Include gateway tests 2026-11-30 14:30:33 -05:00
Owen
d3cf234e58
Fix tests for consistancy and to use node:test 2026-11-30 14:29:29 -05:00
Owen Schwartz
d119d0cf6b
Merge pull request #4190 from Tyagiquamar/fix/4135-disable-config-managed-domains
fix(config): remove stale config-managed domains when disabled
2026-11-30 12:16:22 -05:00
Owen
1a78f9c36f
Scope round-trip messages to their org and newt 2026-11-30 10:29:37 -05:00
Owen Schwartz
043d31c5af
Merge pull request #4199 from Tosko4/chore/installer-traefik-3.7.20
chore(installer): pin Traefik v3.7.20 (security fixes)
2026-11-30 09:42:27 -05:00
vaibhavdabas16
5be842ba7f fix(log-streaming): don't escalate back-off while a backlog is draining
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.
2026-11-30 10:34:59 +05:30
vaibhavdabas16
4b4ad69c71 fix(log-streaming): don't resend delivered events after a partial failure
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
2026-11-30 10:34:58 +05:30
vaibhavdabas16
3bea14c2b6 fix(log-streaming): allow single data fields in HTTP body templates
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
2026-11-30 10:32:09 +05:30
dependabot[bot]
2a830c8ee7
Bump the npm-dependencies group across 1 directory with 18 updates
Bumps the npm-dependencies group with 18 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-s3) | `3.1169.0` | `3.1178.0` |
| [@hookform/resolvers](https://github.com/react-hook-form/resolvers) | `7.0.6` | `7.0.9` |
| [@tanstack/react-query](https://github.com/TanStack/query/tree/HEAD/packages/react-query) | `5.107.1` | `5.108.4` |
| [express-rate-limit](https://github.com/express-rate-limit/express-rate-limit) | `8.7.4` | `8.7.5` |
| [ioredis](https://github.com/redis/ioredis) | `6.0.0` | `6.1.0` |
| [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) | `1.73.0` | `1.81.0` |
| [next-intl](https://github.com/amannn/next-intl) | `4.15.1` | `4.16.2` |
| [nodemailer](https://github.com/nodemailer/nodemailer) | `10.5.0` | `10.6.1` |
| [posthog-node](https://github.com/PostHog/posthog-js/tree/HEAD/packages/node) | `5.74.0` | `6.2.0` |
| [recharts](https://github.com/recharts/recharts) | `3.10.1` | `3.11.1` |
| [stripe](https://github.com/stripe/stripe-node) | `23.1.0` | `23.2.0` |
| [tailwind-merge](https://github.com/dcastil/tailwind-merge/tree/HEAD/packages/tailwind-merge) | `3.7.0` | `3.7.1` |
| [@react-email/ui](https://github.com/resend/react-email/tree/HEAD/packages/ui) | `6.11.13` | `6.11.17` |
| [@tanstack/react-query-devtools](https://github.com/TanStack/query/tree/HEAD/packages/react-query-devtools) | `5.107.1` | `5.108.4` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `26.6.6` | `26.6.11` |
| [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) | `19.3.0` | `19.3.3` |
| [react-email](https://github.com/resend/react-email/tree/HEAD/packages/react-email) | `6.11.16` | `6.11.17` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.73.0` | `8.74.0` |



Updates `@aws-sdk/client-s3` from 3.1169.0 to 3.1178.0
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-s3/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.1178.0/clients/client-s3)

Updates `@hookform/resolvers` from 7.0.6 to 7.0.9
- [Release notes](https://github.com/react-hook-form/resolvers/releases)
- [Commits](https://github.com/react-hook-form/resolvers/compare/v7.0.6...v7.0.9)

Updates `@tanstack/react-query` from 5.107.1 to 5.108.4
- [Release notes](https://github.com/TanStack/query/releases)
- [Changelog](https://github.com/TanStack/query/blob/main/packages/react-query/CHANGELOG.md)
- [Commits](https://github.com/TanStack/query/commits/@tanstack/react-query@5.108.4/packages/react-query)

Updates `express-rate-limit` from 8.7.4 to 8.7.5
- [Release notes](https://github.com/express-rate-limit/express-rate-limit/releases)
- [Commits](https://github.com/express-rate-limit/express-rate-limit/compare/v8.7.4...v8.7.5)

Updates `ioredis` from 6.0.0 to 6.1.0
- [Release notes](https://github.com/redis/ioredis/releases)
- [Changelog](https://github.com/redis/ioredis/blob/main/CHANGELOG.md)
- [Commits](https://github.com/redis/ioredis/compare/v6.0.0...v6.1.0)

Updates `lucide-react` from 1.73.0 to 1.81.0
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/1.81.0/packages/lucide-react)

Updates `next-intl` from 4.15.1 to 4.16.2
- [Release notes](https://github.com/amannn/next-intl/releases)
- [Commits](https://github.com/amannn/next-intl/compare/next-intl@4.15.1...next-intl@4.16.2)

Updates `nodemailer` from 10.5.0 to 10.6.1
- [Release notes](https://github.com/nodemailer/nodemailer/releases)
- [Changelog](https://github.com/nodemailer/nodemailer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodemailer/nodemailer/compare/v10.5.0...v10.6.1)

Updates `posthog-node` from 5.74.0 to 6.2.0
- [Release notes](https://github.com/PostHog/posthog-js/releases)
- [Changelog](https://github.com/PostHog/posthog-js/blob/main/packages/node/CHANGELOG.md)
- [Commits](https://github.com/PostHog/posthog-js/commits/posthog-node@6.2.0/packages/node)

Updates `recharts` from 3.10.1 to 3.11.1
- [Release notes](https://github.com/recharts/recharts/releases)
- [Changelog](https://github.com/recharts/recharts/blob/main/CHANGELOG.md)
- [Commits](https://github.com/recharts/recharts/compare/v3.10.1...v3.11.1)

Updates `stripe` from 23.1.0 to 23.2.0
- [Release notes](https://github.com/stripe/stripe-node/releases)
- [Changelog](https://github.com/stripe/stripe-node/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-node/compare/v23.1.0...v23.2.0)

Updates `tailwind-merge` from 3.7.0 to 3.7.1
- [Release notes](https://github.com/dcastil/tailwind-merge/releases)
- [Commits](https://github.com/dcastil/tailwind-merge/commits/tailwind-merge@3.7.1/packages/tailwind-merge)

Updates `@react-email/ui` from 6.11.13 to 6.11.17
- [Release notes](https://github.com/resend/react-email/releases)
- [Changelog](https://github.com/resend/react-email/blob/canary/packages/ui/CHANGELOG.md)
- [Commits](https://github.com/resend/react-email/commits/@react-email/ui@6.11.17/packages/ui)

Updates `@tanstack/react-query-devtools` from 5.107.1 to 5.108.4
- [Release notes](https://github.com/TanStack/query/releases)
- [Changelog](https://github.com/TanStack/query/blob/main/packages/react-query-devtools/CHANGELOG.md)
- [Commits](https://github.com/TanStack/query/commits/@tanstack/react-query-devtools@5.108.4/packages/react-query-devtools)

Updates `@types/node` from 26.6.6 to 26.6.11
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@types/react` from 19.3.0 to 19.3.3
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Updates `react-email` from 6.11.16 to 6.11.17
- [Release notes](https://github.com/resend/react-email/releases)
- [Changelog](https://github.com/resend/react-email/blob/canary/packages/react-email/CHANGELOG.md)
- [Commits](https://github.com/resend/react-email/commits/react-email@6.11.17/packages/react-email)

Updates `typescript-eslint` from 8.73.0 to 8.74.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.74.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-s3"
  dependency-version: 3.1178.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: "@hookform/resolvers"
  dependency-version: 7.0.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-dependencies
- dependency-name: "@tanstack/react-query"
  dependency-version: 5.108.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: express-rate-limit
  dependency-version: 8.7.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-dependencies
- dependency-name: ioredis
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: lucide-react
  dependency-version: 1.81.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: next-intl
  dependency-version: 4.16.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: nodemailer
  dependency-version: 10.6.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: posthog-node
  dependency-version: 6.2.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm-dependencies
- dependency-name: recharts
  dependency-version: 3.11.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: stripe
  dependency-version: 23.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: tailwind-merge
  dependency-version: 3.7.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-dependencies
- dependency-name: "@react-email/ui"
  dependency-version: 6.11.17
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-dependencies
- dependency-name: "@tanstack/react-query-devtools"
  dependency-version: 5.108.4
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
- dependency-name: "@types/node"
  dependency-version: 26.6.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-dependencies
- dependency-name: "@types/react"
  dependency-version: 19.3.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-dependencies
- dependency-name: react-email
  dependency-version: 6.11.17
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-dependencies
- dependency-name: typescript-eslint
  dependency-version: 8.74.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-30 01:37:08 +00:00
dependabot[bot]
3291fed94f
Bump the github-actions-dependencies group across 1 directory with 2 updates
Bumps the github-actions-dependencies group with 2 updates in the / directory: [actions/setup-go](https://github.com/actions/setup-go) and [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer).


Updates `actions/setup-go` from 7.0.0 to 7.1.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](b7ad1dad31...d8cbb8045d)

Updates `sigstore/cosign-installer` from 4.1.3 to 4.1.4
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](756fe2d284...881c63bd87)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-dependencies
- dependency-name: sigstore/cosign-installer
  dependency-version: 4.1.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-30 01:34:08 +00:00
Alex
9023aa71dc
fix: do not return expired certificates from domain lookup 2026-11-27 23:22:46 -04:00
Tosko4
1ea01469ac chore(installer): pin Traefik v3.7.20 (security fixes) 2026-11-28 02:58:57 +01:00
Tosko4
a79b98efe8 feat(setup): optional retention for SQLite migration backups 2026-11-28 02:20:27 +01:00
Owen
e056d5163d
Merge branch 'main' into dev 2026-11-26 23:47:26 -05:00
Owen
cee8f1ca43
Update to bigserial 2026-11-26 23:47:08 -05:00
Alex
0aa483c972
fix(setup): exit when PostgreSQL is unreachable at startup 2026-11-26 11:10:32 -04:00
Tyagiquamar
158fc5bb1c
fix(config): remove stale config-managed domains when disabled 2026-11-26 12:11:35 +05:30
Owen Schwartz
c50155384b
Merge pull request #4189 from fosrl/cross-org-fixes
Cross-org security fixes: local sites, SSRF, redirects, device approvals, private AI gateway
2026-11-25 21:22:43 -05:00
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 Schwartz
22e8dc6988
Merge pull request #4187 from fosrl/dev
Security fixes: prototype pollution, p-host trust, resource auth info, custom roles
2026-11-25 18:49:41 -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