export interface OwnerPrivateDirStat { isSymlink: boolean; isDir: boolean; uid: number; mode: number; } /** * Reject reasons for an owner-private directory reused from a shared temp base: * it must be a real directory (not a symlink an attacker planted), owned by us, * with no group/other access. Returns `null` when the directory is safe to use. * Pure so the rejection matrix is testable without root. */ export declare function ownerPrivateDirError(stat: OwnerPrivateDirStat, expectedUid: number | undefined): string | null; /** * Harden a directory pulled from a shared temp base, where another local user * may have created the path first. * * Opens the final path component with `O_NOFOLLOW | O_DIRECTORY` so a symlink or * non-directory is refused atomically at open time, then inspects and normalizes * that one pinned inode through the fd (`fstat`/`fchmod`) — never a second * pathname lookup. This closes the swap window where another local user could * replace the entry with a symlink between two `stat`s and slip a victim-owned * 0700 target past the checks (#9070). Rejects a symlink, a non-directory, a * foreign owner, or lingering group/other access via {@link ownerPrivateDirError}. * POSIX only: Windows lacks `O_NOFOLLOW`/`O_DIRECTORY`. * * @param label Human-readable directory role prefixed to the thrown message. */ export declare function assertOwnerPrivateDir(dir: string, label: string): void;