Skip to content

Conversation

@pranav-gupta-msft
Copy link

Add untrusted-data-instance-note to APIs that handle external XML/SRGS/SSML/audio files to warn developers about security risks when processing untrusted data.

Changes:

  • SrgsDocument: Added class-level warning and warnings to constructors that accept file paths and XmlReader
  • Grammar: Added warnings to constructors that accept file paths and streams
  • PromptBuilder: Added warnings to AppendSsml(XmlReader) and AppendAudio(string) methods
  • GrammarBuilder: Added warnings to AppendRuleReference methods that accept file paths

These APIs can load and parse external files which may contain corrupted or malicious content. The warnings direct developers to validate all inputs per OWASP guidelines.

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

Add untrusted-data-instance-note to APIs that handle external XML/SRGS/SSML/audio files to warn developers about security risks when processing untrusted data.

Changes:
- SrgsDocument: Added class-level warning and warnings to constructors that accept file paths and XmlReader
- Grammar: Added warnings to constructors that accept file paths and streams
- PromptBuilder: Added warnings to AppendSsml(XmlReader) and AppendAudio(string) methods
- GrammarBuilder: Added warnings to AppendRuleReference methods that accept file paths

These APIs can load and parse external files which may contain corrupted or malicious content. The warnings direct developers to validate all inputs per OWASP guidelines.
@pranav-gupta-msft pranav-gupta-msft requested a review from a team as a code owner December 16, 2025 05:43
Copilot AI review requested due to automatic review settings December 16, 2025 05:43
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 16, 2025
@pranav-gupta-msft
Copy link
Author

@dotnet-policy-service agree company="Microsoft"

Copy link
Contributor

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 PR adds security warnings to System.Speech APIs that handle external data sources (XML, SRGS, SSML, and audio files) to alert developers about potential security risks when processing untrusted data.

Key changes:

  • Added untrusted-data-instance-note include directives to constructors and methods that accept file paths, streams, or XmlReader objects
  • Applied warnings consistently across four XML documentation files covering speech recognition and synthesis APIs
  • Class-level and method-level warnings added to ensure comprehensive security guidance

Reviewed changes

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

File Description
xml/System.Speech.Synthesis/PromptBuilder.xml Added security warnings to AppendAudio(string) and AppendSsml(XmlReader) methods
xml/System.Speech.Recognition/GrammarBuilder.xml Added security warnings to both AppendRuleReference method overloads that accept file paths
xml/System.Speech.Recognition/Grammar.xml Added security warnings to four constructors that accept file paths or streams
xml/System.Speech.Recognition.SrgsGrammar/SrgsDocument.xml Added class-level security warning and warnings to constructors that accept file paths or XmlReader

<remarks>
<format type="text/markdown"><![CDATA[
[!INCLUDE [untrusted-data-class-note](~/includes/untrusted-data-class-note.md)]
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The include file reference should be untrusted-data-instance-note instead of untrusted-data-class-note to maintain consistency with the other warnings added in this PR. All other locations correctly use untrusted-data-instance-note.

Suggested change
[!INCLUDE [untrusted-data-class-note](~/includes/untrusted-data-class-note.md)]
[!INCLUDE [untrusted-data-instance-note](~/includes/untrusted-data-instance-note.md)]

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants