Skip to content

.Net: [BREAKING] Upgrade Prompty.Core to 2.0.0-beta.3 to resolve NU1903 vulnerability - #14169

Merged
Roger Barreto (rogerbarreto) merged 2 commits into
microsoft:mainfrom
rogerbarreto:nu1903-promptycore-fix
Jul 20, 2026
Merged

Roger Barreto (rogerbarreto) merged 2 commits into
microsoft:mainfrom
rogerbarreto:nu1903-promptycore-fix

Conversation

@rogerbarreto

Copy link
Copy Markdown
Member

Motivation and Context

CI (dotnet-build-and-test) currently fails repo-wide on NU1903: Prompty.Core 0.2.3-beta has a known high severity advisory GHSA-wxhm-2mq7-7697 (path traversal in ${file:...} reference expansion). The build treats the audit as an error (--warnaserror), so this blocks every .NET PR.

The advisory is fixed in Prompty.Core 2.0.0-beta.2+. That release is a significant rewrite: it targets net9.0 only and ships a new .prompty spec and API. There is no intermediate 0.x fix, so resolving the advisory requires this upgrade.

Description

Upgrades Prompty.Core 0.2.3-beta → 2.0.0-beta.3 and adapts Semantic Kernel to the 2.0 surface.

  • Package: bump Prompty.Core in Directory.Packages.props; remove the Scriban workaround reference (2.0 no longer depends on it).
  • Target frameworks: retarget Functions.Prompty to net10.0 only. The fixed package is net9.0-only, so net8.0 and netstandard2.0 can no longer be supported.
  • Loader migration (KernelFunctionPrompty):
    • Text input: FrontmatterParser.Parse + Prompty.Load.
    • File input: secure PromptyLoader.Load with AllowedFileRoots scoped to the prompty file's directory, so ${file:...} references are confined (the fix for the advisory).
    • Parse failures are normalized to ArgumentException to preserve the input-validation contract.
  • Test data + tests: migrate the .prompty files to the 2.0 spec (apiType, list-form inputs, renamed options) and update PromptyTests accordingly.
  • Samples: update the Concepts inline templates to the 2.0 spec.

⚠️ Breaking changes

Microsoft.SemanticKernel.Prompty is a preview (-beta) package. This change:

  • Drops net8.0 and netstandard2.0 support (now net10.0 only).
  • Requires .prompty files to use the 2.0 spec (model.apiType, model.provider, connection.kind, inputs/outputs as lists, renamed model.options). v1 files are not auto-migrated. See the Prompty v1→v2 migration guide.
  • No longer surfaces the following, which are not part of the 2.0 model: input/output json_schema, connection service_id, and arbitrary model.options passthrough beyond the strongly typed set.

Validation

  • Functions.Prompty.UnitTests: 22/22 pass (Release, --warnaserror).
  • Functions.Prompty and Concepts build clean, no NU1903.
  • dotnet format --verify-no-changes clean on changed projects.
  • Behavior coherence: rendered prompt output for the Concepts samples is byte-for-byte identical to the previously published package, and the samples were run end-to-end against a live model with the expected results.

Contribution Checklist

  • The code builds clean without errors or warnings
  • The PR follows the SK Contribution Guidelines
  • All unit tests pass, and I have added/updated tests where possible
  • I didn't break anyone 😄

Bumps Prompty.Core from 0.2.3-beta to 2.0.0-beta.3 to resolve the high severity advisory NU1903 (GHSA-wxhm-2mq7-7697), a path traversal in file reference expansion. The fixed Prompty.Core release targets net9.0 only and ships a rewritten 2.0 spec and API, so this is a breaking change for the preview Microsoft.SemanticKernel.Prompty package.

Changes: retarget Functions.Prompty to net10.0 (drops net8.0 and netstandard2.0); migrate KernelFunctionPrompty to the 2.0 loader (FrontmatterParser plus Prompty.Load for text, secure PromptyLoader with AllowedFileRoots for file references); remove the Scriban workaround reference; migrate the test .prompty files to the 2.0 spec; update samples and tests.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades the .NET Prompty integration to Prompty.Core 2.0.0-beta.3 to resolve the NU1903 vulnerability, and updates Semantic Kernel’s Prompty loader, test data, and samples to match the Prompty 2.0 API/spec changes.

Changes:

  • Bump Prompty.Core to 2.0.0-beta.3 (and remove the prior direct Scriban workaround dependency).
  • Migrate Prompty loading/parsing to Prompty 2.0 APIs, including secure file loading with AllowedFileRoots.
  • Update Prompty unit tests, .prompty test assets, and Concepts samples to the Prompty 2.0 spec fields (e.g., apiType, list-form inputs, renamed options).

Reviewed changes

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

Show a summary per file
File Description
dotnet/src/Functions/Functions.Prompty/KernelFunctionPrompty.cs Migrates Prompty parsing/loading to Prompty 2.0 and maps model options into PromptExecutionSettings.
dotnet/src/Functions/Functions.Prompty/Functions.Prompty.csproj Drops multi-targeting and removes the now-unneeded direct Scriban dependency.
dotnet/src/Functions/Functions.Prompty.UnitTests/TestData/relativeFileReference.prompty Updates test prompty asset formatting (BOM/frontmatter) for Prompty 2.0 parsing.
dotnet/src/Functions/Functions.Prompty.UnitTests/TestData/model.json Updates model schema to Prompty 2.0 (apiType, connection changes).
dotnet/src/Functions/Functions.Prompty.UnitTests/TestData/chatNoExecutionSettings.prompty Migrates inputs to the Prompty 2.0 list-based schema.
dotnet/src/Functions/Functions.Prompty.UnitTests/TestData/chatJsonObject.prompty Migrates model/options fields to Prompty 2.0 naming/shape.
dotnet/src/Functions/Functions.Prompty.UnitTests/TestData/chat.prompty Migrates inputs/outputs and model schema to Prompty 2.0 list-based schema.
dotnet/src/Functions/Functions.Prompty.UnitTests/PromptyTests.cs Updates assertions and adds coverage for Prompty 2.0 parsing behavior changes.
dotnet/samples/Concepts/PromptTemplates/PromptyFunction.cs Updates sample inline prompty YAML to Prompty 2.0 (apiType).
dotnet/Directory.Packages.props Central version bump for Prompty.Core and removal of central Scriban pin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ttings

Remove the AdditionalProperties passthrough in ToExtensionData so arbitrary model.options are no longer forwarded. This aligns the behavior with the documented breaking change and avoids overwriting the strongly typed mapped keys.
@rogerbarreto
Roger Barreto (rogerbarreto) added this pull request to the merge queue Jul 20, 2026
Merged via the queue into microsoft:main with commit 33a3e55 Jul 20, 2026
18 checks passed
@rogerbarreto
Roger Barreto (rogerbarreto) deleted the nu1903-promptycore-fix branch July 20, 2026 17:25

This branch was previously deployed

1 inactive deployment
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.

4 participants