Skip to content

Security: replace eval() in DocuEngine validation with a safe boolean-expression parser #28

Description

@francescobianco

Summary

DocuEngineHelper.validate_params() evaluates backend-provided validation expressions with Python eval(). Even if the remote payload is trusted today, this is a fragile execution path for request validation and makes local reasoning about safety much harder.

Reproduction

Inspect src/openapi_mcp_sdk/apis/docuengine.py and follow the validation branch for requestStructure.validation.

Expected

Validation logic should use a small safe parser or an explicit boolean-expression evaluator.

Actual

The current implementation builds a string expression and passes it to eval().

Suggested direction

A small parser supporting and, or, and parentheses would likely be enough for this use case.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions