Skip to content

Commit 5ce1820

Browse files
VibeSWEclaude
andcommitted
Document caller gates for execute_oss_tool helpers
execute_oss_tool and execute_oss_tool_with_query_headers are public and dispatch any tool in the full OSS catalog, including alert action tools, but unlike call_tool_registry they do not check session validity, tenant suspension or the global Query permission. Spell out these obligations in the doc comments so a future in-process caller applies them. No runtime behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent cc46ee5 commit 5ce1820

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎src/tool_executor.rs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,26 @@ async fn execute_oss_tool_inner(
17871787
/// Execute a registered OSS tool in-process. Enterprise uses this only after
17881788
/// applying its own agent policy and action-confirmation checks, so catalog
17891789
/// validation and the underlying platform implementation remain canonical.
1790+
///
1791+
/// # Caller obligations
1792+
///
1793+
/// Unlike [`call_tool_registry`], this function applies only catalog argument
1794+
/// validation and each tool's own per-resource `authorize()` check. Before
1795+
/// calling it, the caller must:
1796+
///
1797+
/// - confirm the session is still valid (`Users.session_exists`);
1798+
/// - reject suspended tenants with
1799+
/// `middleware::check_suspension_for_tenant(tenant_id, Action::Query)`;
1800+
/// - authorize the global `Action::Query` gate for the session;
1801+
/// - restrict which tools may run. Lookup uses the full [`oss_tool_specs`],
1802+
/// including action tools such as `create_alert`, `enable_alert`,
1803+
/// `disable_alert`, `evaluate_alert` and `create_alert_target`, whereas the
1804+
/// HTTP route exposes only [`oss_read_tool_specs`] (plus dashboard writes
1805+
/// when enabled). Action tools need the caller's own confirmation policy.
1806+
///
1807+
/// The same obligations apply to [`execute_oss_tool_with_query_headers`].
1808+
///
1809+
/// [`oss_read_tool_specs`]: crate::tool_catalog::oss_read_tool_specs
17901810
pub async fn execute_oss_tool(
17911811
name: &str,
17921812
arguments: &Value,
@@ -1801,6 +1821,10 @@ pub async fn execute_oss_tool(
18011821
/// Execute a registered OSS tool with separate headers for internal query-node
18021822
/// requests. Prism callers use this to preserve their server-authenticated
18031823
/// routing headers without changing the external MCP execution path.
1824+
///
1825+
/// Callers must apply the session, tenant-suspension, global `Query` and
1826+
/// tool-restriction gates listed on [`execute_oss_tool`]; none are enforced
1827+
/// here.
18041828
pub async fn execute_oss_tool_with_query_headers(
18051829
name: &str,
18061830
arguments: &Value,

0 commit comments

Comments
 (0)