Skip to content

Commit 4ca557a

Browse files
authored
Merge pull request #69 from VibeEngineeringAI/fix/pr62-20-execute-oss-tool-gates
PR #62 follow-up 20: document caller gates for execute_oss_tool helpers
2 parents 9d83d93 + ed50755 commit 4ca557a

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
@@ -1840,6 +1840,26 @@ async fn execute_oss_tool_inner(
18401840
/// Execute a registered OSS tool in-process. Enterprise uses this only after
18411841
/// applying its own agent policy and action-confirmation checks, so catalog
18421842
/// validation and the underlying platform implementation remain canonical.
1843+
///
1844+
/// # Caller obligations
1845+
///
1846+
/// Unlike [`call_tool_registry`], this function applies only catalog argument
1847+
/// validation and each tool's own per-resource `authorize()` check. Before
1848+
/// calling it, the caller must:
1849+
///
1850+
/// - confirm the session is still valid (`Users.session_exists`);
1851+
/// - reject suspended tenants with
1852+
/// `middleware::check_suspension_for_tenant(tenant_id, Action::Query)`;
1853+
/// - authorize the global `Action::Query` gate for the session;
1854+
/// - restrict which tools may run. Lookup uses the full [`oss_tool_specs`],
1855+
/// including action tools such as `create_alert`, `enable_alert`,
1856+
/// `disable_alert`, `evaluate_alert` and `create_alert_target`, whereas the
1857+
/// HTTP route exposes only [`oss_read_tool_specs`] (plus dashboard writes
1858+
/// when enabled). Action tools need the caller's own confirmation policy.
1859+
///
1860+
/// The same obligations apply to [`execute_oss_tool_with_query_headers`].
1861+
///
1862+
/// [`oss_read_tool_specs`]: crate::tool_catalog::oss_read_tool_specs
18431863
pub async fn execute_oss_tool(
18441864
name: &str,
18451865
arguments: &Value,
@@ -1854,6 +1874,10 @@ pub async fn execute_oss_tool(
18541874
/// Execute a registered OSS tool with separate headers for internal query-node
18551875
/// requests. Prism callers use this to preserve their server-authenticated
18561876
/// routing headers without changing the external MCP execution path.
1877+
///
1878+
/// Callers must apply the session, tenant-suspension, global `Query` and
1879+
/// tool-restriction gates listed on [`execute_oss_tool`]; none are enforced
1880+
/// here.
18571881
pub async fn execute_oss_tool_with_query_headers(
18581882
name: &str,
18591883
arguments: &Value,

0 commit comments

Comments
 (0)