aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_map.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/api_map.go
parent153acb7f644d755c45533b7c5311e3ffa47e8973 (diff)
downloadthehouseoficarus-7eab582d8a8ee2af1a6baae7baf0696c7005de2e.tar.gz
fix: harden triggers, economy, casino, world data, and admin/net paths
Diffstat (limited to 'internal/admin/api_map.go')
-rw-r--r--internal/admin/api_map.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/admin/api_map.go b/internal/admin/api_map.go
index 5eac385..d0372df 100644
--- a/internal/admin/api_map.go
+++ b/internal/admin/api_map.go
@@ -24,6 +24,16 @@ func (s *AdminServer) handleMap(w http.ResponseWriter, r *http.Request) {
}
dir := r.URL.Query().Get("dir")
+ if dir != "" {
+ // Route the map's directory through the same guard every other room
+ // API uses, so ?dir=../../.. cannot read/walk outside data/rooms.
+ clean, err := s.resolveRoomSubdir(dir)
+ if err != nil {
+ failJSON(w, err.Error())
+ return
+ }
+ dir = clean
+ }
seed := s.cfg.StartingRoom
if dir != "" {
if low, ok := findLowestLoadableRoom(s, dir); ok {