diff options
| author | historia <[not public]> | 2026-09-16 02:14:02 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-16 02:14:02 -0400 |
| commit | ad60843fbf577eda80105e3916822d663aaefcb3 (patch) | |
| tree | 68092a6403fdb2992ef92cfe0e2dd62b479935aa /internal/admin/yaml_util.go | |
| parent | 61881fd0c1a7066293f552be1a747143f70d03ff (diff) | |
| download | thehouseoficarus-ad60843fbf577eda80105e3916822d663aaefcb3.tar.gz | |
fix: economy recovery double-refund/erased-liability/cap-drops, entity editor path traversal
Diffstat (limited to 'internal/admin/yaml_util.go')
| -rw-r--r-- | internal/admin/yaml_util.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/admin/yaml_util.go b/internal/admin/yaml_util.go index 7157f15..9ef8058 100644 --- a/internal/admin/yaml_util.go +++ b/internal/admin/yaml_util.go @@ -182,6 +182,9 @@ func findEntityPath(dataDir, subdir, id string) (string, error) { } func moveEntityFile(dataDir, subdir, id, targetDir string) (string, string, []byte, error) { + if targetDir != "" && !validEntityID(targetDir) { + return "", "", nil, fmt.Errorf("invalid directory: %q", targetDir) + } oldPath, err := findEntityPath(dataDir, subdir, id) if err != nil { return "", "", nil, fmt.Errorf("entity not found: %s/%s", subdir, id) @@ -228,6 +231,9 @@ func createEntityDir(dataDir, subdir, name string) error { } func renameEntityFile(dataDir, subdir, oldID, newID string) (string, string, []byte, error) { + if !validEntityID(newID) { + return "", "", nil, fmt.Errorf("invalid new id: %q", newID) + } oldPath, err := findEntityPath(dataDir, subdir, oldID) if err != nil { return "", "", nil, fmt.Errorf("entity not found: %s/%s", subdir, oldID) |
