Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements security improvements to the Python setup script by replacing assertions with proper exception handling and adding validation for the assembler tool path to prevent potential security vulnerabilities.
Changes:
- Replaced assert statements with explicit exception raising for better error handling
- Added assembler tool path validation to prevent execution of untrusted tools
- Converted list comprehension to explicit loop for assembler compilation with shell=False flag
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if not os.path.exists(itt_dir): | ||
| raise FileNotFoundError('The specified directory with ITT API source code does not exist.') | ||
|
|
||
| if itt_dir == ITT_DEFAULT_DIR and not len(os.listdir(itt_dir)): |
There was a problem hiding this comment.
The not len(os.listdir(itt_dir)) pattern is unnecessarily verbose. Use the more idiomatic not os.listdir(itt_dir) which directly evaluates the truthiness of the list.
Suggested change
| if itt_dir == ITT_DEFAULT_DIR and not len(os.listdir(itt_dir)): | |
| if itt_dir == ITT_DEFAULT_DIR and not os.listdir(itt_dir): |
| [run([os.path.join(as_path, as_tool), '/Fo', obj_file, '/c', asm_file], check=True) | ||
| for obj_file, asm_file in obj_asm_pairs] | ||
| for obj_file, asm_file in obj_asm_pairs: | ||
| run([as_full_path, '/Fo', obj_file, '/c', asm_file], check=True, shell=False) |
Check notice
Code scanning / Bandit
subprocess call - check for execution of untrusted input. Note
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.
No description provided.