Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

14.0 KB
Raw Blame

Agent Share gate: builtin allowlist evidence

Reviewer record for AGENT_SHARE_ALLOWED_BUILTIN_IDENTIFIERS (@lobechat/builtin-tools). Update it whenever an identifier is added to or kept out of that allowlist.

Denied builtins

Rationale for every registered builtin identifier that is DENIED β€” i.e. absent from AGENT_SHARE_ALLOWED_BUILTIN_IDENTIFIERS. Under a denylist an identifier had to be explicitly proven dangerous to be blocked; under the allowlist an identifier has to be explicitly proven safe to be exposed, so this block exists purely to record the evidence trail for reviewers β€” the denial itself needs no code beyond "not in the Set".

Confirmed leak paths (a concrete visitor→creator-data route was found):

  • lobe-agent-management: agentManagementRuntime is scoped by userId (the creator β€” the run executes as the creator), but agentId is a free-form model argument on nearly every API. searchAgent enumerates the creator's whole workspace; getAgentDetail returns any creator-owned agent's full config (system prompt included) for an arbitrary id; createAgent / updateAgent / updatePrompt / duplicateAgent / installPlugin persistently mutate the creator's agent collection.

  • agent-signal-review: listManagedSkills / getManagedSkill prefer an optional model-supplied agentId over the context-bound one, letting a visitor read ANY other agent's private managed-skill catalog under the same creator. writeMemory / createSkillIfAbsent / replaceSkillContentCAS are unconditional creator-scoped mutations, and share grants are none/read only.

  • lobe-skill-maintainer / agent-signal-skill-management: hidden, system-only tools whose every API WRITES agent-document rows under the creator's account. No write grant exists to honor.

  • lobe-task / builtin-goal: TaskModel/taskRouter are scoped only by userId/workspaceId β€” the CREATOR's. Every mutating and single-task-read API takes a model-supplied identifier resolved with no topic/conversation check, letting a visitor read, edit, delete, reschedule or RUN (spending the creator's budget) any task in the workspace. listTasks's scope: 'allAgents' makes the breadth explicit.

  • lobe-creds: injectCreds takes a free-form keys: string[] and decrypts matching entries out of the creator's ENTIRE saved credential store.

  • lobe-message: every bot-management API resolves botId straight from model args with no check against context.agentId; the messenger APIs act on the creator's whole personal messenger account.

  • lobe-skill-store: the importFrom* family fetches attacker-chosen remote code/zip content and persists it into the creator's skill catalog.

  • lobe-agent-builder: updateConfig/updatePrompt overwrite the shared agent's own systemRole/config wholesale β€” a visitor rewriting the creator's live agent. installPlugin installs an arbitrary market MCP plugin onto it as the creator, with no consent step.

  • lobe-brief: createBrief unconditionally persists a row via BriefModel.create under context.userId (the creator) from model-supplied content, with no intervention marker to gate it.

  • lobe-group-agent-builder / lobe-group-management: group-orchestration tools operating on the creator's group-agent collection and membership, with no share-run scoping designed in β€” same risk class as lobe-agent-management.

Denied for lack of positive safety evidence (no confirmed exploit was required to withhold access β€” the point of default-deny is that an unproven tool does not ship):

  • lobe-local-system / lobe-browser / lobe-remote-device: these proxy through deviceGateway to the creator's own registered physical device(s). A visitor executing arbitrary commands or driving a live browser session on the CREATOR's own machine is a far larger blast radius than any single data store, so they are never offered through the tool picker. They are granted only by shareConfig.deviceAccess: contacts admits everyone currently in the address book of the Agent's scope (personal contacts, or the workspace's members and external contacts), including people added later; allowlist admits only visitors named in deviceAllowUserIds, and only while they are still in that address book. everyone admits every signed-in visitor holding the link, set only after the creator confirms that it reaches strangers; a legacy stored all stays denied. The explicit creator choice is resolved once per gate by resolveShareVisitorDeviceAccess into canUseDevice and re-applied at dispatch. The same grant admits device-only MCP servers (which still need their own tool grant). The device is always the Agent's configured execution environment; a visitor never picks it, and project directories stay denied. The grant covers the engine's device tools (DEVICE_TOOL_IDENTIFIERS, so computer use too) except the lobe-remote-device picker: with it the visitor's model could list and activate the creator's other machines, so it stays default-denied even under the grant. The same grant lets the visitor run a heterogeneous Agent that runs locally (Claude Code, Codex and the other local CLIs) on that device; without it the run is refused, and a share run never falls back to the cloud sandbox.

  • lobe-web-onboarding: reads and WRITES the creator's own onboarding SOUL.md document and persona.

  • lobe-self-feedback-intent / agent-signal-reflection / agent-signal-feedback-intent: hidden, system-only self-iteration tools whose write paths were never audited for share safety.

  • lobe-page-agent: not unsafe β€” genuinely unreachable for a share visitor's run (execAgent strips it whenever appContext?.scope !== 'page', and the share visitor path never sets scope), so allowlisting it would only let the owner-facing tool picker confirm a grant no visitor conversation can ever exercise.

  • lobe-user-interaction: originally denied because share runs were forced headless, so it could never honestly complete. Share runs now honor the visitor's approval flow, but it stays denied until audited on its own.

  • Device-only MCP servers (stdio, or an HTTP endpoint on localhost / a private network): not builtin identifiers, so the allowlist above never sees them β€” the server can only call them by tunneling to the creator's online desktop app (or, with no device gateway, by spawning the binary on the server itself), exactly as it would for the creator. Without the share's device grant, applyShareGateToToolSet drops them regardless of toolGrants and ToolExecutionService.executeMCPTool refuses the dispatch; with it, they follow their ordinary toolGrants entry.

Allowed builtins with general reach

Positive evidence for builtin identifiers that WERE added to AGENT_SHARE_ALLOWED_BUILTIN_IDENTIFIERS despite reaching outside a single data store β€” recorded here, rather than left implicit, because their general-purpose reach needs an explicit safety argument instead of just the absence of a known exploit.

  • lobe-cloud-sandbox: general-purpose shell/script execution, but a share visitor's run gets a fresh, isolated per-topic sandbox session β€” never the creator's own sandbox state. The lh CLI's JWT credential shim (preprocessLhCommand.ts) that would otherwise mint a creator-scoped token inside a shell the visitor controls is skipped entirely for agentShareVisitor runs (serverRuntimes/cloudSandbox.ts), and lobe-creds stays denied above so nothing ever writes ~/.creds/env into that session either. No creator credential or JWT is therefore reachable from inside a visitor's sandbox command. The kept manifest's systemRole also gets shareVisitorSystemPrompt appended (applyShareGateToCloudSandbox in toolSet.ts), so the model knows lh is refused before it plans a flow the agent prompt or a skill routes through the CLI.

  • lobe-activator: widens the run's tool surface at runtime, so it is allowed only because every source it reads is already the gated set. Never picked by the owner: any tool grant implies it, and so does the device grant (Computer Use is discoverable, not enabled), scoped to activateTools (shareGate/grants.ts:132, which also overrides a stored entry so nothing widens it to the runtime's unlisted activateSkill), and assembly drops it again when no granted tool is left to activate, counting restored historical activations as already enabled (shareGate/toolSet.ts:166). A kept activator gets the share-visitor systemRole (getSystemPromptForShareVisitor), which omits the default prompt's push to activate lobe-skill-store first and keeps its activateSkill lines only when lobe-skills itself survived the gate. Credential discovery lives in the lobe-creds manifest, which the gate excludes.

    1. What it can see. <available_tools> is the operation's manifestMap minus enabled tools (apps/server/src/modules/AgentRuntime/executorHelpers.ts:644), and that map is the one applyShareGateToToolSet pruned in place (apps/server/src/services/aiAgent/pipeline/operationPrep.ts:559). An ungranted MCP server or plugin contributes no name or description.
    2. What it can activate. activateTools only resolves ids present in context.toolManifestMap (apps/server/src/services/toolExecution/serverRuntimes/activator.ts:166), which is the step's effectiveManifestMap (apps/server/src/modules/AgentRuntime/adapters/ServerToolTransport.ts:310): the gated operation map plus manifests of earlier activations, themselves copied from the same map (packages/agent-runtime/src/executors/tool.ts:117, :567). An ungranted id comes back as "Not found".
    3. Calls in the same step. The tool-call resolver only accepts a call the step offered, or one whose identifier and API exist in the step's prompt manifests (packages/context-engine/src/engine/tools/ToolNameResolver.ts:284); a tool activated in this response is not offered until the next step, so a same-response call to it is dropped. Whatever does reach dispatch still meets the dispatch-time gates: isShareBlockedBuiltinDispatch for builtins (apps/server/src/services/toolExecution/builtin.ts:192) and the gated manifest lookup for MCP (apps/server/src/services/toolExecution/index.ts:253).
    4. Activations restored from history. operationPrep re-derives them into activatableToolIds (apps/server/src/services/aiAgent/pipeline/operationPrep.ts:535) before the share gate prunes that list, and AgentRuntimeService restores only ids still in it (apps/server/src/services/agentRuntime/AgentRuntimeService/createOperation.ts:182).
    5. Its skill fallback. activateTools retries a non-tool id as a skill name. That lookup re-checks shareConfig.skillGrants on every source it opens (apps/server/src/services/toolExecution/serverRuntimes/activator.ts:97), the same rule the skills runtime enforces, so it cannot reach a skill the share did not grant.
  • lobe-skills: the tool DOES resolve skills out of the creator's personal catalog β€” that is what it is for, and it was denied for exactly that reason until the catalog stopped being the unit of authorization. What changed is that the creator now names individual skills (shareConfig.skillGrants), so the reachable set is an explicit allowlist instead of "everything the creator owns minus an opt-out disabledSkillIds set". Three things make that allowlist the real boundary rather than a UI suggestion:

    1. the operation's skill pool is intersected with it at assembly (filterSkillsByShareGate, applied in operationPrep);
    2. activateSkill resolves a MODEL-SUPPLIED name, so assembly alone would be bypassable β€” the skill runtime re-checks the allowlist at load time, on every path that opens skill content (name/id resolution AND the archive/resource loads that execScript and readReference reach through). A name outside the grant fails there even if the model invents it;
    3. only activateSkill / readReference survive at all (AGENT_SHARE_SKILL_API_NAMES, enforced by the rule above): both are pure reads of granted skill content. The exec-class APIs, which are what would turn a granted skill into arbitrary code running as the creator, stay blocked.

    The grant deliberately carries whatever the granted skill itself does β€” a creator who opens a skill opens that skill's instructions, and that is the premise of Agent Share, not a hole in it. The gate's job is to execute the grant exactly, not to second-guess which skills a creator should share.

  • lobe-work: the one builtin a visitor run gets WITHOUT a creator grant (AGENT_SHARE_IMPLIED_BUILTIN_IDENTIFIERS): resolveEffectiveShareToolGrants implies it, getShareGrantActivatedPluginIds enables it, and filterPluginsByShareGate keeps it, so the owner's picker shows no toggle for it. It only registers what the run produced as Work cards:

    1. the run (operation, topic, tool call, assistant message) comes from the execution context, never from model arguments;
    2. writes go through WorkModel under the share scope pinned to the visitor topic (resolveRunWorkAccessScope), so the Works never reach the creator's ordinary lists; a visitor run without a topic is refused;
    3. updateWork / deleteWork reach only Works this conversation created through the tool or lh work (agentEditable), never ones collected automatically or made in another conversation;
    4. collection images must be images of the run's account (resolveAgentWorkCollectionItems): a generated image or run output must also appear in a tool result of the visitor topic, and any other image must come from an exportFile call of that topic (its state's fileId), so a guessed id of another creator image is refused as not found.

    Its implied grant is added after the activator check, so it never implies lobe-activator on its own.