Skip to content

Conversation

@cpinn
Copy link
Contributor

@cpinn cpinn commented Dec 10, 2025

Run prompts in the sandbox environment, depabtable but seems recommended for untrusted templates

Run prompts in the sandbox environment, depabtable but seems recommended for untrusted templates
"GitPython",
"requests",
"chevron",
"jinja2>=3.1.6",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jinja appeared to have some bad vulnerabilities prior to 3.1.5 so I chose 3.1.6 as min version.


def render_templated_object(obj: Any, args: Any) -> Any:

class _JinjaSafeDict:
Copy link
Contributor Author

@cpinn cpinn Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into jinja accessing . as function methods during evaluation (ie. TypeError: 'builtin_function_or_method' object is not iterable). This would prevent that by wrapping the dictionary values. Some users may find this and the sandbox environment to be restrictive but start with safety.

@ibolmo
Copy link
Collaborator

ibolmo commented Jan 2, 2026

@cpinn is this one still needed?

@cpinn
Copy link
Contributor Author

cpinn commented Jan 5, 2026

@cpinn is this one still needed?
Yep, still needed, just needed a small update. I had wanted to do a little bit of testing with the api as well.

template_format: TemplateFormat | None = None

@classmethod
def from_dict_deep(cls, d: dict):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome input here.

I want the api to accept nunjucks but I want users of the sdk to interact with jinja.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants