Pin pre-commit version and align installation logic between bash and Windows setup scripts#54
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
Co-authored-by: omsherikar <180152315+omsherikar@users.noreply.github.com>
Co-authored-by: omsherikar <180152315+omsherikar@users.noreply.github.com>
Co-authored-by: omsherikar <180152315+omsherikar@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR aligns the pre-commit installation logic between the bash (setup_dev.sh) and Windows (setup_dev.bat) setup scripts. Previously, the Windows script would unconditionally reinstall pre-commit on every run, while the bash script checked for its existence first. This change eliminates unnecessary reinstalls and ensures consistent behavior across platforms.
Key changes:
- Added pre-commit existence check to Windows script using both
wherecommand andpip showpackage verification - Conditional installation that only proceeds when pre-commit is not found
- Aligned warning message format with bash script
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
setup_dev.bat
Outdated
|
|
||
| if "%PRE_COMMIT_EXISTS%"=="0" ( | ||
| echo ⚠️ pre-commit not found. Installing... | ||
| python -m pip install pre-commit --quiet |
There was a problem hiding this comment.
The line python -m pip install pre-commit --quiet downloads and executes a third-party package from PyPI without any version pinning or integrity verification, which exposes the development environment to supply-chain compromise if the pre-commit package or its dependencies are hijacked. An attacker who gains control of that package stream could execute arbitrary code with the developer's privileges when this script is run. Consider pinning pre-commit to a specific trusted version and enabling hash-based or signature-based verification so that the installed artifact is both reproducible and integrity-checked.
There was a problem hiding this comment.
Pinned pre-commit to version 4.5.1 in requirements-dev.txt. Both scripts now install pre-commit from the requirements file instead of installing it dynamically, providing version pinning and supply-chain protection. Commit: 9d4228d
Co-authored-by: omsherikar <180152315+omsherikar@users.noreply.github.com>
The bash script checked for pre-commit existence before installing while the Windows script always installed it unconditionally, causing unnecessary reinstalls. Additionally, both scripts had a supply-chain security vulnerability by installing pre-commit without version pinning.
Changes:
pre-commit==4.5.1torequirements-dev.txtwith pinned version for supply-chain securitysetup_dev.shandsetup_dev.batto rely on requirements-dev.txt installationpip install pre-commitcalls from both scriptsBefore:
Bash (setup_dev.sh):
Windows (setup_dev.bat):
After:
requirements-dev.txt:
Both scripts (setup_dev.sh and setup_dev.bat):
Security improvements:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.