plainpath

package
v0.6.1014-dev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package plainpath checks a path under an os.Root before a tree that a container wrote is read: every part of the path is looked at with Lstat and must be a plain directory, and the last must be a regular file (or a plain directory, for Dir). A link, a junction, a device or any other special file anywhere on the way is refused, never followed.

os.Root already refuses a link that leads out of the root. This does not rest on that: a Windows build followed one, because os.Root's escape check there depends on reparse-point handling. It also refuses links that stay inside the root, which os.Root follows. The trees it guards are written by a container that has ended before they are read, so nothing races the check.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir(root *os.Root, rel string) error

Dir checks that rel, a slash path under root, is a plain directory reached through plain directories only.

func File

func File(root *os.Root, rel string) (fs.FileInfo, error)

File checks that rel, a slash path under root, is a regular file reached through plain directories only, and returns its Lstat info (for a size check). A last part that is not a regular file is refused with "not a regular file".

Types

This section is empty.

Jump to

Keyboard shortcuts

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