secureopen

package
v1.260801.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempNoFollow added in v1.260731.0

func CreateTempNoFollow(dir string, pattern string, perm os.FileMode) (*os.File, error)

CreateTempNoFollow creates a new temporary file in dir using an unpredictable name derived from crypto/rand, an exclusive create, and no-follow semantics.

The pattern follows os.CreateTemp semantics: the last "*" is replaced with random text, or random text is appended when the pattern has no "*".

func CreateTempNoFollowInRoot added in v1.260731.0

func CreateTempNoFollowInRoot(root *os.Root, dir string, pattern string, perm os.FileMode) (*os.File, string, error)

CreateTempNoFollowInRoot creates a new temporary file beneath root and returns both the file and its root-relative name. Parent resolution stays anchored to root even if a directory is concurrently replaced by a symlink.

func OpenAppendNoFollow added in v1.260731.0

func OpenAppendNoFollow(path string, perm os.FileMode) (*os.File, error)

OpenAppendNoFollow opens a file for appending without following symlinks, creating it when it does not exist.

func OpenAppendNoFollowInRoot added in v1.260731.0

func OpenAppendNoFollowInRoot(root *os.Root, name string, perm os.FileMode) (*os.File, error)

OpenAppendNoFollowInRoot opens a file for appending relative to root without following the final component or permitting parent traversal outside root.

func OpenExistingAppendNoFollowInRoot added in v1.260731.0

func OpenExistingAppendNoFollowInRoot(root *os.Root, name string) (*os.File, error)

OpenExistingAppendNoFollowInRoot opens an existing file for atomic appends without following the final component.

func OpenExistingNoFollow

func OpenExistingNoFollow(path string) (*os.File, error)

OpenExistingNoFollow opens an existing file without following symlinks.

func OpenExistingNoFollowInRoot added in v1.260731.0

func OpenExistingNoFollowInRoot(root *os.Root, name string) (*os.File, error)

OpenExistingNoFollowInRoot opens an existing file relative to root without following the final component or permitting parent traversal outside root.

func OpenExistingWritableNoFollowInRoot added in v1.260731.0

func OpenExistingWritableNoFollowInRoot(root *os.Root, name string) (*os.File, error)

OpenExistingWritableNoFollowInRoot opens an existing file for writing relative to root without following its final component. Opening the existing inode lets callers honor write ACLs and preserve filesystem metadata.

func OpenNewFileNoFollow

func OpenNewFileNoFollow(path string, perm os.FileMode) (*os.File, error)

OpenNewFileNoFollow creates a new file without following symlinks. Uses O_EXCL to prevent overwriting existing files and O_NOFOLLOW to prevent symlink attacks.

func OpenNewFileNoFollowInRoot added in v1.260731.0

func OpenNewFileNoFollowInRoot(root *os.Root, name string, perm os.FileMode) (*os.File, error)

OpenNewFileNoFollowInRoot creates a new file relative to root without following the final component or permitting parent traversal outside root.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL