Files
ARTEX/server/upload_open_unix.go
T
BaaRai 90cd290d42 security: follow-up hardening for the upload and capture fixes
Tighten existing spill blob permissions on startup, charge 32 bytes per hook range pair, and open uploads with O_NOFOLLOW on Unix. Tests cover the startup walk, the 32-byte charge and the no-follow open.
2026-11-22 09:10:59 +01:00

15 lines
379 B
Go

//go:build !windows
package server
import (
"os"
"syscall"
)
// openUploadFileNoFollow opens dest for writing without following a symlink at
// the final path component, closing the TOCTOU window after refuseUploadSymlink.
func openUploadFileNoFollow(dest string) (*os.File, error) {
return os.OpenFile(dest, os.O_WRONLY|os.O_CREATE|os.O_TRUNC|syscall.O_NOFOLLOW, 0o644)
}