diff options
| author | historia <[not public]> | 2026-10-05 19:30:49 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-05 19:30:49 -0400 |
| commit | a5447965e7808d656a5e5d9326a9ca0231148f85 (patch) | |
| tree | 618d46ccf2119658d0a6cc9e7b7a27fd75c0fee0 /internal/admin/correct_audit_fixes_test.go | |
| parent | 1091d0fae96d152c11aec1bb2dd949f51ed5aa1e (diff) | |
| download | thehouseoficarus-a5447965e7808d656a5e5d9326a9ca0231148f85.tar.gz | |
feat: sym-link containment, batch count prompt for crafting
Diffstat (limited to 'internal/admin/correct_audit_fixes_test.go')
| -rw-r--r-- | internal/admin/correct_audit_fixes_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/admin/correct_audit_fixes_test.go b/internal/admin/correct_audit_fixes_test.go index d97732d..d7b713e 100644 --- a/internal/admin/correct_audit_fixes_test.go +++ b/internal/admin/correct_audit_fixes_test.go @@ -73,3 +73,19 @@ func TestUndoFailureIsReportedDistinctly(t *testing.T) { t.Fatal("empty history must be a clean nil change and nil error") } } + +// Regression: a symlink inside data/ pointing outside it must not let the raw +// file API read or write outside the data directory. +func TestResolveDataPathRejectsSymlinkEscape(t *testing.T) { + dir := t.TempDir() + outside := t.TempDir() + if err := os.Symlink(outside, filepath.Join(dir, "link")); err != nil { + t.Skipf("symlinks unsupported: %v", err) + } + if _, err := resolveDataPath(dir, "link/secret.yaml"); err == nil { + t.Fatal("a symlink escaping the data directory was accepted") + } + if _, err := resolveDataPath(dir, "rooms/1.yaml"); err != nil { + t.Fatalf("normal path rejected: %v", err) + } +} |
