Documentation
¶
Index ¶
- Variables
- func CleanupSensitiveTemp(path string) error
- func CreateSensitiveTemp(dir, pattern string) (*os.File, error)
- func PreparePrivateDirectory(path string) error
- func RemovePrivateFile(path string) error
- func ReplacementApplied(err error) bool
- func SameTarget(first, second string) (bool, error)
- func SyncReplacement(path string) error
- func ValidatePrivateFile(path string) error
- type PostCommitError
- type PrivateReplace
- type Target
- func (t *Target) AtomicWrite(raw []byte, mode os.FileMode) error
- func (t *Target) AtomicWritePrivate(raw []byte) error
- func (t *Target) BeginPrivateReplace(reserve int64) (*PrivateReplace, error)
- func (t *Target) Path() string
- func (t *Target) Read() ([]byte, os.FileInfo, error)
- func (t *Target) ReadBoundedRegular(limit int64) ([]byte, os.FileInfo, error)
- func (t *Target) Verify() error
- func (t *Target) WithLock(ctx context.Context, timeout, retry time.Duration, fn func() error) error
Constants ¶
This section is empty.
Variables ¶
var ErrPrivateRetirementAlias = errors.New("private file and retirement tombstone refer to the same file")
var ErrTargetReplaced = errors.New("configuration target was replaced")
Functions ¶
func CleanupSensitiveTemp ¶
CleanupSensitiveTemp removes a file created by CreateSensitiveTemp and its empty private staging directory. It is safe to call after the file has been atomically moved to its final destination.
func CreateSensitiveTemp ¶
CreateSensitiveTemp creates a temporary file inside a freshly-created, current-user-only staging directory. The directory and file are both normalized and verified before the caller can write credential material.
func PreparePrivateDirectory ¶
func RemovePrivateFile ¶ added in v0.2.2
RemovePrivateFile durably retires a validated current-user-only file from its canonical path before best-effort tombstone cleanup. Windows uses a write-through namespace move; Unix syncs the containing directory.
func ReplacementApplied ¶ added in v0.2.2
func SameTarget ¶ added in v0.2.2
SameTarget reports whether two requested paths resolve to the same file. When both files are absent and differ only by case, it probes the containing filesystem instead of assuming case behavior from the operating system.
func SyncReplacement ¶ added in v0.2.2
SyncReplacement establishes a durability barrier for an atomic replacement that is already visible at path. Unix persists the containing directory; Windows flushes the installed file and its replacement metadata.
func ValidatePrivateFile ¶
Types ¶
type PostCommitError ¶ added in v0.2.2
type PostCommitError struct{ Err error }
PostCommitError reports a failure that happened after an atomic replacement became visible. Callers that coordinate multiple files must reconcile the target contents instead of assuming the old file is still active.
func (*PostCommitError) Error ¶ added in v0.2.2
func (e *PostCommitError) Error() string
func (*PostCommitError) Unwrap ¶ added in v0.2.2
func (e *PostCommitError) Unwrap() error
type PrivateReplace ¶
type PrivateReplace struct {
// contains filtered or unexported fields
}
func (*PrivateReplace) Abort ¶
func (p *PrivateReplace) Abort() error
func (*PrivateReplace) Commit ¶
func (p *PrivateReplace) Commit(raw []byte) error
func (*PrivateReplace) CommitWithLock ¶ added in v0.2.2
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
Target is the stable filesystem target behind a requested configuration path. Resolving symlinks once and verifying them again under the sidecar lock prevents a writer from silently switching files during a transaction.
func (*Target) AtomicWritePrivate ¶
AtomicWritePrivate replaces a credential-bearing file with a canonical current-user-only file. Unlike AtomicWrite, it never preserves arbitrary security metadata from the old target.
func (*Target) BeginPrivateReplace ¶
func (t *Target) BeginPrivateReplace(reserve int64) (*PrivateReplace, error)
BeginPrivateReplace prepares and reserves space for a private atomic replacement before a remote one-time credential rotation is attempted.