Commit graph

3 commits

Author SHA1 Message Date
Danny Avila
254c2a9b06
🔓 fix: Keep owner as the Default Mode for API Key Runs (#18448)
#18377 made `delegated` the default of endpoints.agents.remoteApi.integrations.mode, so
on upgrade a run started with a personal API key lost its MCP tools until the operator
declared servers and the key's owner granted them. That is a surprise for deployments
that never asked for grants.

The default is `owner` again: a key run uses the MCP servers its owner can, as before
grants existed. `delegated` stays available as an opt-in. The config loader's warning now
fires only for an operator who sets `delegated` and declares no server to grant.
2026-11-19 06:58:22 -05:00
Danny Avila
d24769ea1a
🔐 feat: Limit API Key Runs to Their Grants by Default (#18377) 2026-11-18 14:05:23 -05:00
Danny Avila
3375bb5c3c
🗝️ feat: Limit an API Key's Runs to the MCP Tools Its Owner Granted It (#18280)
* 🗝️ feat: Store an API Key's MCP Grants on the Key, One per Agent

* 🧬 refactor: Let the Consent Service and Enforcement Act for Any Grant Subject

* 🗝️ feat: Check an API Key Run's MCP Calls Against the Key's Grant for the Agent

* 🗝️ feat: Put Remote API Runs Under Their Key's Grant, Behind a Config Switch

* 🩹 fix: Export the Key Grant Storage the Server Wiring Loads

* 🔌 feat: Let an Owner Grant an API Key Its MCP Access From Settings

* 🗝️ fix: Decide Key Grant Access, Mode and Kind of Key in the TypeScript Host

The agent-access check and the grant-mode lookup lived in the legacy route and service
files. The host now builds the check from an injected agent reader and permission
reader, and the key handlers resolve the mode from an injected configuration reader.

Each authorized call read the owner three times and their configuration twice. The host
now reads both once per call and shares them between the access check, the limits and
the offer; nothing is kept between calls.

A background worker rebuilds its request from the admitted record, which names the key
but not its kind, so a key issued to an integration lost its exemption and its channel
runs were refused. The host asks the key store when the request carries no key itself.

* 🔌 fix: Say When a Key Grant's Agent List Is Loading, Failed or Empty

The key grant dialog turned a failed or pending agent list into an empty picker with an
instruction to choose from it. It now shows a spinner while the list loads, an error
with a retry when it could not be read and nothing is cached, and a plain statement when
the owner has no agent the key could run.

* 🧪 test: Hold the Pin Fences on an API Key's Per-Agent Grants

* 🔌 fix: Offer a Key Grant for the Agents the Key Can Run, and Only for Personal Keys

The grant dialog's picker read the app's agent catalog, which lists agents the owner can
view. Running an agent with a key follows another rule: the agent is shared with the
owner for remote use, or is theirs to share. An agent shared only for remote use could be
run but not granted. A new list, GET /api/api-keys/agents, applies that rule to all
agents, and the picker reads it.

A key issued to an integration holds no grants but showed the MCP access button. The key
list now marks such a key, and the button is not shown for it.
2026-11-18 13:28:39 -05:00