-
Notifications
You must be signed in to change notification settings - Fork 3.3k
update subprocess cmd #15218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update subprocess cmd #15218
Conversation
Signed-off-by: nithinraok <[email protected]>
Signed-off-by: nithinraok <[email protected]>
Signed-off-by: nithinraok <[email protected]>
| 'Mozilla/5.0 (Windows NT 10.0; WOW64) ' | ||
| 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36', |
Check warning
Code scanning / CodeQL
Implicit string concatenation in a list Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 18 days ago
To fix this, we should make the concatenation of the two string literals in the commands list explicit. The goal is to keep the User-Agent value exactly the same while avoiding implicit string concatenation inside the list, thereby satisfying CodeQL and improving readability.
The best minimal change is to join the two adjacent literals on lines 168–169 with + so that Python’s intent is clear while still passing a single User-Agent string as the value for the --user-agent option. We should only edit the string element in the commands list and not change any other behavior or imports.
Concretely, in scripts/dataset_processing/get_commonvoice_data.py, locate the commands = [ block in main() and replace the two-line implicit concatenation:
'Mozilla/5.0 (Windows NT 10.0; WOW64) '
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',with an explicit concatenation (split across lines for readability):
'Mozilla/5.0 (Windows NT 10.0; WOW64) ' +
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',No new methods, imports, or definitions are needed.
-
Copy modified line R168
| @@ -165,7 +165,7 @@ | ||
| commands = [ | ||
| 'wget', | ||
| '--user-agent', | ||
| 'Mozilla/5.0 (Windows NT 10.0; WOW64) ' | ||
| 'Mozilla/5.0 (Windows NT 10.0; WOW64) ' + | ||
| 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36', | ||
| '-O', | ||
| output_archive_filename, |
melllinia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
[🤖]: Hi @nithinraok 👋, We wanted to let you know that a CICD pipeline for this PR just finished successfully. So it might be time to merge this PR or get some approvals. |
* update subprocess cmd Signed-off-by: nithinraok <[email protected]> * common voice script Signed-off-by: nithinraok <[email protected]> * Apply isort and black reformatting Signed-off-by: nithinraok <[email protected]> --------- Signed-off-by: nithinraok <[email protected]> Signed-off-by: nithinraok <[email protected]> Co-authored-by: nithinraok <[email protected]> Signed-off-by: Charlie Truong <[email protected]>
* update subprocess cmd Signed-off-by: nithinraok <[email protected]> * common voice script Signed-off-by: nithinraok <[email protected]> * Apply isort and black reformatting Signed-off-by: nithinraok <[email protected]> --------- Signed-off-by: nithinraok <[email protected]> Signed-off-by: nithinraok <[email protected]> Co-authored-by: nithinraok <[email protected]> Signed-off-by: Charlie Truong <[email protected]>
* update subprocess cmd * common voice script * Apply isort and black reformatting --------- Signed-off-by: nithinraok <[email protected]> Signed-off-by: nithinraok <[email protected]> Signed-off-by: Charlie Truong <[email protected]> Co-authored-by: Nithin Rao <[email protected]> Co-authored-by: nithinraok <[email protected]>
Important
The
Update branchbutton must only be pressed in very rare occassions.An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.
What does this PR do ?
This change converts command strings to argument lists, which is the recommended secure approach for subprocess execution.
Collection: [ASR]
Changelog
run_chunked_inference()intools/asr_evaluator/utils.pyto useshell=Falseby converting the command string to a list of arguments.run_offline_inference()intools/asr_evaluator/utils.pyto useshell=Falseby converting the command string to a list of arguments.Usage
No changes to usage. The ASR evaluator functions wors as before:
GitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".
Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information