fix: replace shell=True with secure subprocess in TranscodePerturbation#15309
Open
Rudra-Tiwari-codes wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
Open
Conversation
ef1d3eb to
92b844e
Compare
Security: Convert amr-nb, ogg, and g711 codecs in TranscodePerturbation from shell=True to secure subprocess patterns using list arguments. Changes: - Replace subprocess.check_output with shell=True to subprocess.Popen and subprocess.run with explicit argument lists for amr-nb and ogg codecs - Replace subprocess.check_output with shell=True to subprocess.run with list arguments for g711 codec - Use subprocess.DEVNULL for stderr to suppress unnecessary output - Properly close stdout pipes and wait for encoder process completion to prevent potential resource leaks - Remove unused 'Any' import from typing module This follows the precedent set in PR NVIDIA-NeMo#15165 which fixed similar security vulnerabilities in data_utils.py. Signed-off-by: Rudra-Tiwari-codes <rudratiwari2006@gmail.com> Signed-off-by: Rudra Tiwari <tiwarirudra2006@gmail.com>
92b844e to
18add2c
Compare
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.
fix: replace shell=True with secure subprocess in TranscodePerturbation
Description
This PR addresses a security vulnerability where
shell=Truewas used insubprocesscalls within theTranscodePerturbationclass. Following the precedent set in PR #15165, these calls have been refactored to use secureshell=Falseimplementations with explicit argument lists.Changelog
amr-nb,ogg, andg711codecs inTranscodePerturbationfromshell=Trueto secure subprocess patterns using explicit argument listsstdout.close()andwait()to prevent resource leakssubprocess.DEVNULLfor stderr to prevent potential deadlocks from unread buffersAnyimport from typing moduleProposed Changes
nemo/collections/asr/parts/preprocessing/perturb.pyTesting
Pre checks
PR Type
Please review:
@titu1994, @redoctopus, @jbalam-nv, @okuchaiev
Additional Information