aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/undo.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 15:16:44 -0400
committerhistoria <[not public]>2026-09-18 15:16:44 -0400
commit7eab582d8a8ee2af1a6baae7baf0696c7005de2e (patch)
tree902bbc8c6e39c9f62f779ca23267714ec420b9f5 /internal/admin/undo.go
parent153acb7f644d755c45533b7c5311e3ffa47e8973 (diff)
downloadthehouseoficarus-7eab582d8a8ee2af1a6baae7baf0696c7005de2e.tar.gz
fix: harden triggers, economy, casino, world data, and admin/net paths
Diffstat (limited to 'internal/admin/undo.go')
-rw-r--r--internal/admin/undo.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/admin/undo.go b/internal/admin/undo.go
index 7bfbe09..24ce9c1 100644
--- a/internal/admin/undo.go
+++ b/internal/admin/undo.go
@@ -9,6 +9,8 @@ import (
"strings"
"sync"
"time"
+
+ "thehouseoficarus/internal/persistence"
)
type ExtraFile struct {
@@ -537,12 +539,12 @@ func (us *UndoStack) save() {
log.Printf("undo: failed to marshal history: %v", err)
return
}
- if err := os.WriteFile(us.filePath, b, 0600); err != nil {
+ if err := persistence.WriteFile(us.filePath, b, 0600); err != nil {
log.Printf("undo: failed to write history file: %v", err)
return
}
- // os.WriteFile does not change an existing file's mode: tighten a history
- // file that a previous version created world-readable.
+ // persistence.WriteFile preserves an existing file's mode: tighten a
+ // history file that a previous version created world-readable.
if err := os.Chmod(us.filePath, 0600); err != nil {
log.Printf("undo: failed to secure history file: %v", err)
}