From f72213b70f949583523a73aa67697d82e5a997b7 Mon Sep 17 00:00:00 2001 From: Pranav Gupta Date: Tue, 16 Dec 2025 11:11:16 +0530 Subject: [PATCH] docs: Add untrusted data security warnings to System.Speech APIs 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. --- .../SrgsDocument.xml | 6 ++++++ xml/System.Speech.Recognition/Grammar.xml | 8 ++++++++ xml/System.Speech.Recognition/GrammarBuilder.xml | 4 ++++ xml/System.Speech.Synthesis/PromptBuilder.xml | 10 +++++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/xml/System.Speech.Recognition.SrgsGrammar/SrgsDocument.xml b/xml/System.Speech.Recognition.SrgsGrammar/SrgsDocument.xml index 1c329a5e37b..4b3ca1d838a 100644 --- a/xml/System.Speech.Recognition.SrgsGrammar/SrgsDocument.xml +++ b/xml/System.Speech.Recognition.SrgsGrammar/SrgsDocument.xml @@ -31,6 +31,8 @@ instance and build a grammar by adding instances of classes that represent SRGS elements, such as , ,, , , and . You can also construct an instance from an existing SRGS-compliant XML grammar file, from an instance of , or from an instance of . @@ -284,6 +286,8 @@ recognizer.LoadGrammarAsync(g); from the file named "srgsDocumentFile.xml". @@ -326,6 +330,8 @@ if (File.Exists(srgsDocumentFile)) from an instance of that references the file "srgsDocumentFile.xml". diff --git a/xml/System.Speech.Recognition/Grammar.xml b/xml/System.Speech.Recognition/Grammar.xml index 673bfaebf5d..f724dfc9c10 100644 --- a/xml/System.Speech.Recognition/Grammar.xml +++ b/xml/System.Speech.Recognition/Grammar.xml @@ -437,6 +437,8 @@ private static Grammar CreateSrgsDocumentGrammar() A fully qualified path to the audio file. Appends the specified audio file to the . - To be added. + + + @@ -960,6 +966,8 @@ namespace SampleSynthesis