feat: apply sealed installation plans without interactive setup

This commit is contained in:
Codex
2026-10-06 15:45:18 +02:00
parent c3c9f509bf
commit 8b9a086fd6
31 changed files with 1542 additions and 45 deletions
+15
View File
@@ -0,0 +1,15 @@
package safeio
import (
"os"
"path/filepath"
)
// PublishCanonicalNewFile durably publishes complete bytes without replacing an existing
// target. A crash before publication can leave a private temporary file, never a partial target.
func PublishCanonicalNewFile(path string, contents []byte, mode os.FileMode) error {
if ValidateCanonicalPath(path) != nil || ValidatePrivateDirectory(filepath.Dir(path)) != nil || (mode != 0o600 && mode != 0o644) {
return ErrUnsafeFile
}
return publishCanonicalNewFile(path, contents, mode)
}