use os.*Root instead of os to prevent filesystem traversal bugs and security leaks

This commit is contained in:
2026-05-06 22:22:41 -06:00
parent 3505f0e059
commit 2ae5ee8285
6 changed files with 45 additions and 41 deletions
+4 -1
View File
@@ -34,7 +34,10 @@ func newTestServer(t *testing.T, mirrorHandler http.HandlerFunc) (*httptest.Serv
mirror := httptest.NewServer(mirrorHandler)
t.Cleanup(func() { mirror.Close() })
c := cache.NewCache(t.TempDir(), []string{mirror.URL + "/"}, []string{"core"})
c, err := cache.NewCache(t.TempDir(), []string{mirror.URL + "/"}, []string{"core"})
if err != nil {
t.Fatalf("failed to create cache: %v", err)
}
cfg := &Config{
Port: "0",
Auth: AuthConfig{Token: "testtoken"},