Skip to main content
Glama

Detectar inyección en plantillas (SSTI)

detect_ssti_risk

Analiza el código fuente de una herramienta que compila una plantilla (Jinja2, EJS, Handlebars, Pug, Mustache, lodash, o un PromptTemplate de LangChain) en busca de una fuente de plantilla que no escribió el desarrollador — una variable/entrada externa usada como el TEXTO de la plantilla, en vez de como un dato que se rellena en una plantilla fija. La mayoría de estos motores permiten llamar métodos y recorrer atributos de objetos desde dentro de la plantilla, así que una plantilla controlada por un atacante puede terminar en ejecución arbitraria de código en el servidor (SSTI) — algo distinto de XSS y no cubierto por ningún analizador de HTML. También detecta una falsa sensación de seguridad propia de Garita: el código afirma estar protegido porque "escapa la salida" (autoescape=True, html.escape, MarkupSafe) — una defensa real contra XSS pero irrelevante acá, porque la ejecución ocurre al COMPILAR la plantilla, antes de que exista ninguna salida que escapar. Reconoce un entorno sandboxeado de Jinja2 (SandboxedEnvironment) como una mitigación real. Motivada por CVE-2026-33154 (CVSS 8.1) en Dynaconf, una librería de configuración muy usada por apps de IA/agentes; un aviso en Agenta-AI (plataforma de evaluación de LLMs) por SSTI vía plantillas Jinja2 de evaluador personalizado; y un aviso en LangChain mismo, el framework de agentes más usado, por inyección en plantillas de prompt vía acceso a atributos. Es un análisis estático por patrones de texto (no ejecuta el código) — mismo enfoque que detect_sql_injection_risk, detect_command_injection_risk y detect_insecure_deserialization_risk. 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_ssti_risk"
  }
}

Input Schema

NameRequiredDescriptionDefault
codigoYesEl código fuente de la función/herramienta que compila una plantilla, 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

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses that this is static text-pattern analysis that does not execute the code, that it requires a valid access key (free uses or credits, POST /crear-llave), and how it reasons about findings — SandboxedEnvironment counts as a real mitigation while autoescape/html.escape/MarkupSafe do not. It also warns about a specific false-confidence pattern it will flag, which is unusually informative for interpreting results.

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 purpose is front-loaded in the first sentence, which is good, but the body is a single dense paragraph that keeps going: CVE-2026-33154, the Agenta-AI advisory, the LangChain advisory, and the autoescape discussion. The mitigation and false-confidence logic earns its place; the three-advisory motivation block is background that delays the reader rather than helping them invoke the tool.

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

Completeness4/5

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

There is no output schema and no annotations, so the description must set expectations, and it largely does: detection scope, supported engines, static-analysis nature, auth requirement, and mitigation handling. The remaining gap is what a finding actually looks like (severity, location, message shape), which an agent would need to interpret or chain the result.

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%, and both parameters (codigo, lenguaje) are documented in the schema, including that lenguaje is informational only. The description adds nothing beyond that — it never mentions either parameter explicitly — so the baseline of 3 applies.

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 target: it analyzes the source code of a tool that compiles a template (Jinja2, EJS, Handlebars, Pug, Mustache, lodash, LangChain PromptTemplate) looking for an externally-controlled template *text*. It explicitly separates itself from XSS and from HTML analyzers, so an agent can tell it apart from the sibling detect_* tools without opening a 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?

Gives clear selection context: use it on code that compiles templates where the template text may come from an external variable, and it names the sibling analyzers (detect_sql_injection_risk, detect_command_injection_risk, detect_insecure_deserialization_risk) as the same approach for other vuln classes. It lacks an explicit 'do not use when' statement and doesn't say what to do if the template is static, but the intended domain is unambiguous.

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