Skip to content

Commit d8fa1c4

Browse files
authored
feat(security): restrict backup file permissions to owner-only (#40)
1 parent c4ebfd3 commit d8fa1c4

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

.jules/sentinel.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2026-02-24 - Insecure Backup Permissions
2+
**Vulnerability:** Backup archives created by `tools/backup-projects.sh` were readable by all users on the system (0644 default permissions). These archives contain sensitive project files and potentially secrets.
3+
**Learning:** Shell scripts using `zip` or `tar` often inherit default umask settings, which are typically permissive. Creating backups in shared environments (even multi-user home machines) requires explicit permission handling.
4+
**Prevention:** Enforce `umask 0077` (or strict `chmod`) when creating sensitive files or archives in shell scripts. Always assume the default environment is insecure.
15
# Sentinel Journal
26

37
## 2026-04-15 - Prevent TOCTOU in SSH Key Restoration

tools/backup-projects.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ cmd_backup() {
431431
exclude_args=$(build_exclude_args)
432432

433433
(
434+
# Restrict permissions for backup file (owner read/write only)
435+
umask 0077
434436
cd "$HOME" || exit 1
435437
if [[ "$VERBOSE" == true ]]; then
436438
# shellcheck disable=SC2086

0 commit comments

Comments
 (0)