Repository navigation
Python: docs(python): clarify prompt template trust boundary - #14648
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits intoOct 23, 2026
Merged
Conversation
Document that template source can invoke registered kernel functions and add a regression test showing template-like argument values remain literal. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg (eavanvalkenburg)
requested a review
from a team
as a code owner
October 23, 2026 12:53
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 12:53 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 12:54 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:54 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:54 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:54 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:54 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
had a problem deploying
to
github-app-auth
October 23, 2026 12:54 — with
GitHub Actions
Failure
Copilot started reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
October 23, 2026 12:54
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The documentation and focused regression test clarify existing behavior without runtime changes, and no unresolved issues were identified.
No open issues 🎉
What changed in this PR
Clarifies the Python prompt template trust boundary and documents how to pass untrusted text safely, without changing runtime behavior or defaults.
Changes:
- Documents that trusted template source can invoke registered functions during rendering.
- Explains that untrusted text belongs in template arguments and that content escaping does not prevent template function execution.
- Adds a regression test confirming template syntax in argument values remains literal and does not invoke functions.
| File | Description |
|---|---|
python/tests/unit/prompt_template/test_kernel_prompt_template.py |
Tests literal rendering of template syntax supplied through arguments. |
python/semantic_kernel/template_engine/README.md |
Adds security guidance and a safe argument-passing example. |
python/semantic_kernel/prompt_template/kernel_prompt_template.py |
Documents the template source trust requirement in the class docstring. |
python/semantic_kernel/agents/agent.py |
Clarifies the trust requirement for agent instruction templates. |
Review effort: Balanced
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||
Eduard van Valkenburg (eavanvalkenburg)
had a problem deploying
to
github-app-auth
October 23, 2026 13:03 — with
GitHub Actions
Failure
Jose Alvarez (jpalvarezl)
approved these changes
Oct 23, 2026
Eduard van Valkenburg (eavanvalkenburg)
had a problem deploying
to
github-app-auth
October 23, 2026 15:16 — with
GitHub Actions
Failure
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 17:37 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 17:37 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 17:37 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 17:37 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 17:37 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
deleted the
sk-template-safety
branch
October 23, 2026 17:59
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Semantic Kernel prompt template source can invoke functions registered in the
Kernelduring rendering, but this executable-configuration trust boundary was not explicit. This change documents the supported safe pattern for handling untrusted user-, network-, file-, or service-provided text without changing existing template behavior.Description
Validation:
uv run --python 3.12 --frozen pytest tests\unit\prompt_template\test_kernel_prompt_template.py --quiet— passed (10 tests).uv run --python 3.12 --frozen ruff check semantic_kernel\agents\agent.py semantic_kernel\prompt_template\kernel_prompt_template.py tests\unit\prompt_template\test_kernel_prompt_template.py— passed.uv run --python 3.12 --frozen pre-commit run -a— not completed; stopped during first-time hook environment installation to avoid delaying PR creation.Contribution Checklist