Skip to main content
Glama

Escudo de Código Dinámico

detect_dynamic_code_risk

Analiza el código fuente de una herramienta/agente en busca de ejecución de código dinámico no confiable (CWE-95): eval(), el constructor Function() de JS, exec() de Python, y las variantes del módulo "vm" de Node (vm.runInContext/runInNewContext/runInThisContext) llamadas con un texto que NO escribió el desarrollador — una variable, la respuesta de un modelo, un documento recuperado de un pipeline RAG, o un parámetro de herramienta — en vez de un texto fijo. También detecta el patrón de "eval implícito": setTimeout()/setInterval() llamado con un string en vez de una referencia a función. Detecta además una falsa sensación de seguridad propia de Garita: usar la librería vm2 para "sandboxear" la ejecución no es una mitigación real — vm2 está oficialmente deprecada desde 2023 tras varias fugas de sandbox críticas y documentadas (CVE-2023-32314, CVE-2023-37903, CVE-2023-37466); reconoce isolated-vm (aislamiento real a nivel de V8 Isolate) como mitigación genuina. Motivada por CVE-2026-26030 (CVSS 9.8, feb 2026) en Microsoft Semantic Kernel: el filtro de un vector store (InMemoryVectorStore) interpolaba contenido recuperado de un documento indexado — es decir, dato envenenado de un pipeline RAG, no una entrada directa del usuario — directamente en una expresión evaluada con eval(), dando RCE completo en el proceso del agente. Es un análisis estático por patrones de texto (no ejecuta el código) — mismo enfoque que detect_ssti_risk y detect_command_injection_risk, y una clase de vulnerabilidad distinta de esta última: ahí se invoca una shell externa (CWE-78), acá se evalúa código directamente dentro del propio intérprete/motor del agente. Requiere una llave de acceso válida (usos gratis o créditos) — ver POST /crear-llave.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "codigo": "<codigo>"
    },
    "name": "detect_dynamic_code_risk"
  }
}

Input Schema

NameRequiredDescriptionDefault
codigoYesEl código fuente de la función/herramienta que evalúa código dinámicamente, en texto plano.
lenguajeNoSolo informativo (ej. "python", "javascript") — la detección ya cubre varios lenguajes a la vez, este campo no cambia el resultado.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, so the description carries the full load and does it well: it discloses that this is static, pattern-based text analysis that does not execute the code, names the auth prerequisite (valid key, free uses or credits, POST /crear-llave), and states the vm2-vs-isolated-vm verdict it will encode. What is missing is any indication of the response shape — whether it returns findings, severities, or line references.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core definition is front-loaded and correct, but the paragraph is dense and bloated with backstory — the full CVE-2026-26030 narrative and the vm2 CVE enumeration consume a large share of the text before the auth requirement appears. The motivating example earns some place, yet the argument could be shortened without losing selection signal.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter static analyzer with no annotations and no output schema, the description covers what it detects, how it detects it, and what access it needs, which is most of the burden. The remaining gap is the return contract: nothing tells the agent whether to expect a boolean, a findings list, or line-level evidence.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters are already documented. The description reinforces that `lenguaje` is informational only and does not affect results, matching the schema's own note, but adds no new meaning beyond it. Baseline 3 is appropriate when the schema does the work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (static analysis of source code for untrusted dynamic code execution, CWE-95) and enumerates the exact sinks it looks for: eval(), Function(), exec(), vm.runInContext/runInNewContext/runInThisContext, plus string-argument setTimeout/setInterval. It explicitly separates itself from the sibling detect_command_injection_risk (CWE-78 shell invocation vs CWE-95 in-interpreter evaluation), so an agent can pick the right detector without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Clear about the context in which it applies: scanning the source of a tool/agent where text that the developer did not write flows into an evaluation sink. It also explains the boundary versus detect_ssti_risk and detect_command_injection_risk rather than just naming them. It stops short of explicit when-not-to-use guidance (e.g., runtime traces, non-JS/Python languages beyond the vm2/isolated-vm discussion).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources