Skip to content

fix: scope management routes to the signed in owner and resolve client ips through trustedProxy - #196

Merged
thegdsks merged 11 commits into
mainfrom
fix/security-release-candidate
Oct 10, 2026
Merged

thegdsks merged 11 commits into
mainfrom
fix/security-release-candidate

Conversation

@thegdsks

Copy link
Copy Markdown
Member

Scopes the adapter management routes to the signed in owner and stops the adapters, gateway and session helpers from trusting forwarded headers on their own.

What changes

  • Management routes (/agents, /delegations, /audit, /dashboard, POST /authorize): with the default session guard, a signed in user only acts on their own agents, delegations and audit rows. Another user's resource returns 404, a mismatched owner on create returns 403. A custom authenticate resolver is an explicit trust decision and is unchanged. Applies to hono, express, fastify, nestjs, nextjs, nuxt, sveltekit, astro, solidstart and tanstack.
  • Client IP: adapters, the gateway, multi session metadata and the captcha helper resolve the IP through resolveClientIp. Forwarded headers are ignored unless trustedProxy (trustedProxyCount or trustedHeader) is set. Without it an ipAllowlist constraint denies, because the IP is unknown.
  • Gateway CLI and config file can set trustedProxy (--trusted-proxy-count, --trusted-header).
  • NestJS module passes every security option through, so a new option cannot be dropped silently.
  • Peer ranges of the adapters and the gateway move to @glinr/theauth >=0.7.1, because they call guard.resolve and guard.clientIp.
  • Docs: all ten adapter pages and READMEs, the production checklist, and the client IP wording in the REST, rate limiting and troubleshooting pages.

Upgrade notes (also in the changesets)

  1. An app that used the default guard as a shared admin view must pass an authenticate resolver that checks admin rights.
  2. Behind a proxy, set trustedProxy or ipAllowlist constraints will deny.
  3. The captcha helper no longer trusts CF-Connecting-IP unconditionally: trustedProxy: { trustedHeader: "cf-connecting-ip" } keeps it.

Verified

  • Changesets plans patch bumps only (core 0.7.1, gateway 4.0.2, adapters 5.0.1).
  • Core typecheck and lint pass. Core tests for the touched areas: 91 pass.
  • Adapter tests run against a freshly built core (no source alias): hono 59, express 51, fastify 19. The other adapters pass their own tests through the alias.
  • Gateway suite: 64 pass, including the new config loader tests.

Not verified

  • No real framework runtime (Next, Nest, Nuxt and so on) was booted.
  • The CI run on this PR is the first full suite over the whole change.

Follow ups, not in this PR

  • An owner can still create or update their own agents with any permissions. Needs a design decision.
  • Delegation drops the parent's constraints, and revoking a parent agent does not cascade to its delegations.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your first pull request. CI will run shortly. If the change touches package source, please add a changeset with pnpm changeset.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
53.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.22642% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/core/src/adapter-scope.ts 94.20% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@thegdsks
thegdsks merged commit 1fa2338 into main Oct 10, 2026
13 of 14 checks passed
@thegdsks
thegdsks deleted the fix/security-release-candidate branch October 10, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant