Skip to content

Scaffold does not escape --name/--description in generated JSON, HTML, and Python #103

Closed

Description

@TMHSDigital

Why it matters

The scaffold inserts --name and --description raw into JSON, HTML, YAML and Python output.

  • An ordinary description containing a double quote, such as Tools for "Foo" engine, produces invalid plugin.json, package.json and site.json.
  • < or & in a name produces broken HTML.

The result is confusing downstream failures. It also becomes unsafe if the scaffold is ever driven by less-trusted input, for example through an MCP createTool path.

Evidence

  • scaffold/generator.py:98-104 builds the Jinja Environment without autoescape, and no template uses |tojson or |e.
  • scaffold/templates/plugin.json.j2:3-4 contains "name": "{{ name }}" and "description": "{{ description }}". site.json.j2 and package.json.j2 follow the same pattern.
  • scaffold/templates/mcp-server/server.py.j2:14 contains FastMCP("{{ name }}").
  • Reproduced: a " in the description made all three JSON files fail to parse. Markup in the name was emitted unescaped into <title> and <h1> of the generated docs/index.html.

Suggested approach

  • Use {{ value|tojson }} for values inside JSON templates and Python string literals.
  • Turn on autoescaping for HTML templates, with select_autoescape or an explicit |e.
  • Validate CLI input in create-tool.py: reject control characters and set a sensible maximum length.
  • Add a test that scaffolds with a hostile fixture (quotes, angle brackets, backslash, newline) and parses every generated JSON, YAML and HTML file.

Done when

Special characters in name and description produce valid, correctly escaped output in every file type, and a test covers it.

Activity

  1. added
    bug
    priority: high
    security
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: highscaffoldsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions