Skip to content

Conversation

slister1001
Copy link
Contributor

@slister1001 slister1001 commented May 23, 2025

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

All Promptflow Contribution checklist:

  • The pull request does not introduce [breaking changes].
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.
  • I confirm that all new dependencies are compatible with the MIT license.
  • Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: suggested workflow.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces conditional usage of jinja2’s SandboxedEnvironment for template rendering based on the PF_USE_SANDBOX_FOR_JINJA environment variable, ensuring safer template execution. Key changes include:

  • Updating CLI, core utilities, static web blueprint, and connection utilities to use SandboxedEnvironment when enabled.
  • Wrapping template rendering in try/except blocks to capture and re-raise errors as UserErrorException.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/promptflow-devkit/promptflow/_cli/_pf/_init_entry_generators.py Adds sandboxed template loading with conditional environment variable check and error handling.
src/promptflow-core/promptflow/core/_utils.py Updates the render function to support sandboxed templates and wraps rendering logic in a try/except block.
src/promptflow-core/promptflow/core/_serving/v1/blueprint/static_web_blueprint.py Implements conditional sandboxed rendering of static web templates with error capturing.
src/promptflow-core/promptflow/_utils/connection_utils.py Modifies connection template generation to use a sandboxed jinja2 environment, including error handling.

@nagkumar91 nagkumar91 merged commit 6b38d80 into microsoft:main May 27, 2025
12 of 30 checks passed
@vsantele vsantele mentioned this pull request Jul 22, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants