-
-
Notifications
You must be signed in to change notification settings - Fork 88
[releaser] fixed staging untracked files #552 #561
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
base: master
Are you sure you want to change the base?
[releaser] fixed staging untracked files #552 #561
Conversation
📝 WalkthroughWalkthroughThe release tool's git staging command was changed from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🪛 Ruff (0.14.10)openwisp_utils/releaser/release.py362-362: Starting a process with a partial executable path (S607) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
🔇 Additional comments (1)
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
openwisp_utils/releaser/release.py (1)
361-362: LGTM! Security issue addressed correctly.The change from
git add .togit add -usuccessfully prevents untracked files from being staged, addressing the security concern in issue #552. The log message update accurately reflects the new behavior.Consider an even more precise approach:
While
git add -uis a significant improvement, it still stages all tracked changes in the repository. For maximum precision, you could explicitly stage only the files modified by the release process (changelog and version files). This follows the pattern used inport_changelog_to_mainat Line 215.🔎 More precise alternative
- print("Adding tracked changes to git...") - subprocess.run(["git", "add", "-u"], check=True, capture_output=True) + print("Adding release files to git...") + files_to_add = [changelog_path] + if was_bumped and config.get("version_files"): + files_to_add.extend(config["version_files"]) + for file_path in files_to_add: + subprocess.run(["git", "add", file_path], check=True, capture_output=True)Note on static analysis: The S607 warning about partial executable paths exists throughout the file for all git commands and is not introduced by this change.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
openwisp_utils/releaser/release.py
🧰 Additional context used
🪛 Ruff (0.14.10)
openwisp_utils/releaser/release.py
362-362: Starting a process with a partial executable path
(S607)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Python==3.10 | django~=5.0.0
- GitHub Check: Python==3.11 | django~=5.2.0
- GitHub Check: Python==3.13 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=5.2.0
- GitHub Check: Python==3.13 | django~=5.2.0
- GitHub Check: Python==3.11 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=4.2.0
- GitHub Check: Python==3.12 | django~=5.0.0
- GitHub Check: Python==3.10 | django~=4.2.0
- GitHub Check: Python==3.12 | django~=5.1.0
- GitHub Check: Python==3.11 | django~=4.2.0
- GitHub Check: Python==3.10 | django~=5.1.0
- GitHub Check: Python==3.11 | django~=5.0.0
- GitHub Check: Python==3.10 | django~=5.2.0
Replaced git add . With -u to prevent accidental staging of untracked or sensitive files. The tool now only processes changes to files already tracked by the repository. Fixes openwisp#552
981a588 to
b0bc235
Compare
Replaced 'git add .' with '-u' to prevent accidental staging of untracked or sensitive files. The tool now only processes changes to files already tracked by the repository. Fixes #552
Checklist
Reference to Existing Issue
Closes #552
Description of Changes
The releaser tool was using
git add ., which staged all files in the directory including untracked files.I have updated the command to
git add -u, which ensures only files already tracked by git are staged for commitSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.