fix: scope an approval bypass to the tool, not to its whole connector
Approving one tool call with "15 min" or "Session" registered a bypass whose scope was *inferred* from the call's metadata: a registered category if it had one, otherwise its MCP server. For a connector tool that meant the whole connector — so approving `mcp__gmail__modify_message` (labelling, archiving: what an assistant tidying a mailbox does constantly) silently un-gated `mcp__gmail__send_message` for the rest of the conversation, straight through the explicit `require` rule written for it. An email went out with no prompt; the only trace was an INFO line, since bypasses live in RAM. A human answering a card has read one call. That call is the widest thing the click may authorise, so the scope is now always the tool itself and is never guessed. The wider scopes stay in the enum and stay reachable through the REST `bypass_scope` field, where naming one is deliberate. Both fallbacks now narrow instead of widening: a scope that cannot be honoured (a category-less tool, a non-MCP one) and an unknown scope string both degrade to the tool, where they used to fall through to a session-wide bypass. Only a literal "all" disables the gate session-wide. The buttons said "skip similar requests" without ever defining "similar"; they now name the tool.
This commit is contained in:
+12
-9
@@ -73,19 +73,22 @@ export const InboxCardsMixin = (Base) => class extends Base {
|
||||
this._resolveApproval(requestId, 'reject', note, null, null, toolCallId);
|
||||
}
|
||||
|
||||
/** Approve + set a timed or session bypass scoped to the tool's category or MCP server. */
|
||||
/**
|
||||
* Approve + skip approval for **this same tool** for a while.
|
||||
*
|
||||
* Scoped to the tool and nothing wider: the card the human just read is
|
||||
* about one call, and the previous category/MCP-server auto-detect meant a
|
||||
* click on "label this message" also un-gated "send this message" for the
|
||||
* rest of the session.
|
||||
*/
|
||||
_approveWithBypass(item, bypassSecs) {
|
||||
const scope = item.tool_category ? 'category'
|
||||
: item.mcp_server ? 'mcp_server'
|
||||
: 'all';
|
||||
this._resolveApproval(item.request_id, 'approve', '', bypassSecs, scope);
|
||||
this._resolveApproval(item.request_id, 'approve', '', bypassSecs, 'tool');
|
||||
}
|
||||
|
||||
/** Human-readable bypass scope label, e.g. "filesystem" or "Gmail". */
|
||||
/** Short label for the bypass scope — the tool, `mcp__x__y` shown as `y`. */
|
||||
_bypassLabel(item) {
|
||||
if (item.tool_category) return item.tool_category;
|
||||
if (item.mcp_server) return item.mcp_server;
|
||||
return 'session';
|
||||
const name = item.tool_name ?? '';
|
||||
return name.startsWith('mcp__') ? name.split('__').pop() : name;
|
||||
}
|
||||
|
||||
async _resolveClarification(requestId, inputEl) {
|
||||
|
||||
Reference in New Issue
Block a user