securefile

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package securefile owns atomic publication of permission-sensitive files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StageRootKey

func StageRootKey(source, destination string) error

StageRootKey validates a group-readable projected Secret and atomically publishes an owner-only runtime file. Kubernetes applies fsGroup to Secret volumes, which makes the projected source readable by Hikyo's non-root UID; the server still receives the stricter 0400 file required by ReadRootKey.

func WriteAtomic

func WriteAtomic(path string, contents []byte, mode os.FileMode) error

WriteAtomic writes contents beside path, syncs and closes the file, then atomically replaces path and syncs the directory so the rename is durable. Callers own validation and contextual error text.

func WriteAtomicPrepared

func WriteAtomicPrepared(path string, contents []byte, mode os.FileMode, prepare func(*os.File) error) (returnErr error)

WriteAtomicPrepared is WriteAtomic with a prepare hook that runs on the open temporary file after its mode is set and before any byte is written, so a caller can apply ownership or other attributes that must be in place before publication. A nil prepare is a plain WriteAtomic; a prepare error aborts the publication and removes the temporary file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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