Skip to content

[Bug]: Parsing Non-Existent Inline Images in External Uncontrolled Input Text #170

@ebotiab

Description

@ebotiab

In the followings lines of code:

image_path = self.path / image_item
with open(image_path, "rb") as f:
base64_image = base64.b64encode(f.read()).decode("utf-8")

A text variable in prompty may contain references to image paths (e.g., during RAG). However, the parser does not account for cases where these image paths point to non-existent files. This could result in unexpected behavior when processing uncontrolled external input.

Proposed Fix:

  • Add a validation step to check if the referenced image paths exist before attempting to parse them.
  • Alternatively, introduce a configuration option that allows users to disable parsing of inline images if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions