Help us shape the future of Go! Take the 2026 Go Developer Survey

pathguard

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package pathguard refuses database writes under operating-system directories. Creating or writing a signature database in a system root could let an attacker who controls the database path overwrite binaries or configuration when the process runs with elevated privileges.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckWritable

func CheckWritable(path string) error

CheckWritable returns an error if path lies under a system directory, either as written or after resolving symlinks. Symlinks are resolved in the longest prefix of path that exists, so a database that does not exist yet cannot be placed under a system directory through a symlinked parent.

func SystemDir

func SystemDir(goos, path, systemRoot string) string

SystemDir returns the system directory of the given GOOS that contains path, or "" if there is none. systemRoot is the Windows %SystemRoot% directory and is ignored elsewhere. Matching is by whole path component, so /etc does not cover /etcd-data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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