fix: add speechtotextsdk improvements#2562
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Hey @ranadeepsingh 👋! We use semantic commit messages to streamline the release process. Examples of commit messages with semantic prefixes:
To test your commit locally, please follow our guild on building from source. |
There was a problem hiding this comment.
Pull request overview
This PR improves how the Speech-to-Text SDK stage constructs its ffmpeg command by removing shell-based piping and introducing a small helper for command assembly, along with a targeted security-focused test suite.
Changes:
- Refactors
ffmpegcommand construction intoSpeechSDKBase.makeFfmpegCommandand removes/bin/sh -c ... | tee ...execution. - Updates the streaming path to use the new helper and pass an optional recorded-output filename.
- Adds a ScalaTest suite to validate the command is built without invoking a shell and rejects empty recorded filenames.
Show a summary per file
| File | Description |
|---|---|
| cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/speech/SpeechToTextSDK.scala | Refactors ffmpeg invocation to avoid shell execution and centralizes command building. |
| cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/speech/SpeechToTextSDKSecuritySuite.scala | Adds regression/security tests for safe ffmpeg command construction and filename validation. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/speech/SpeechToTextSDK.scala:326
-tis parsed with.toIntwhen computing the ffmpeg process kill timeout. ffmpeg accepts fractional durations (and the new security suite uses-t 2.5), so passing a non-integer value will throwNumberFormatExceptionand fail the transform. Consider parsing asDouble(and rounding/ceiling to seconds forwaitFor) or otherwise validating that the-tvalue is an integer before calling.toInt.
if (getExtraFfmpegArgs.contains("-t")) {
val timeLimit = getExtraFfmpegArgs(getExtraFfmpegArgs.indexOf("-t") + 1).toInt
Future {
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2562 +/- ##
==========================================
+ Coverage 84.74% 84.77% +0.02%
==========================================
Files 334 334
Lines 17756 17783 +27
Branches 1634 1632 -2
==========================================
+ Hits 15048 15076 +28
+ Misses 2708 2707 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This reverts commit fccce86.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Related Issues/PRs
N/A
What changes are proposed in this pull request?
This PR hardens
SpeechToTextSDKaudio recording command construction.ProcessBuilderarguments.http/httpsURIs and adds an ffmpeg protocol whitelist.-, NUL characters, and URI-scheme outputs.How is this patch tested?
Validated with:
Does this PR change any dependencies?
Does this PR add a new feature? If so, have you added samples on website?