fix: harden self-update security and error handling#2
Merged
prettyleaf merged 6 commits intodevfrom Jan 15, 2026
Merged
Conversation
- Use mktemp for secure temporary file creation - Add robust version extraction with format validation - Save and restore IFS variable properly - Validate backup creation success before proceeding - Add comprehensive error handling for mv and chmod operations - Implement automatic backup restoration on failure - Download from tagged version instead of main branch Co-authored-by: prettyleaf <81024464+prettyleaf@users.noreply.github.com>
Co-authored-by: prettyleaf <81024464+prettyleaf@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add version tracking and self-update capabilities to script
fix: harden self-update security and error handling
Jan 15, 2026
prettyleaf
requested changes
Jan 15, 2026
Owner
prettyleaf
left a comment
There was a problem hiding this comment.
needs a check to delete old backup files. if backup is older than 1 day = delete
- Check for existing backup file at start of self_update - Calculate backup file age using stat command (supports both Linux and BSD) - Delete backup if older than 86400 seconds (1 day) - Log cleanup action for audit trail Co-authored-by: prettyleaf <81024464+prettyleaf@users.noreply.github.com>
- Extract timestamp retrieval into separate variable - Use explicit calculation for one_day_seconds (24 * 60 * 60) Co-authored-by: prettyleaf <81024464+prettyleaf@users.noreply.github.com>
Contributor
Author
Added automatic cleanup of backup files older than 1 day in commit 796ac4c. The cleanup runs at the start of
|
- Validate backup_timestamp is non-empty and numeric - Prevents arithmetic errors if stat command fails - Silently skips cleanup if timestamp cannot be determined Co-authored-by: prettyleaf <81024464+prettyleaf@users.noreply.github.com>
prettyleaf
approved these changes
Jan 15, 2026
Owner
Copilot stopped work on behalf of
prettyleaf due to an error
January 15, 2026 11:12
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.
Addresses security vulnerabilities and error handling gaps in the self-update mechanism identified during code review.
Security hardening:
mktempfor temporary files (prevents symlink attacks)v${version}) instead of main branchError handling improvements:
Code quality:
Backup management:
Example of the improved error handling:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.