disclaim

package
v0.167.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package disclaim makes the programs Caprock starts for the user answer for themselves to macOS privacy prompts.

macOS asks before a process reads the Desktop, Documents, Downloads, the Music library, a network volume and a few other places, and it names the process's "responsible" program in the prompt: the app that started it, all the way down the tree. Every agent and shell Caprock starts is a child of the daemon or its pty-host, so a `find /` an agent ran inside a session asked "caprock" for the Music library and network volumes (2026-10-09, tccd log). The binary is ad-hoc signed, a new program to macOS on each release, so the prompt came back after every upgrade, and an answer given to "caprock" covered nothing the user would recognise.

Terminal-like apps solve this by disclaiming responsibility when they start a child: iTerm2 and Chromium pass responsibility_spawnattrs_setdisclaim to posix_spawn. Go's os/exec forks, so the attribute cannot be set there. Instead Wrap rewrites a command to run through Caprock's own binary, which re-executes the real program with posix_spawn(POSIX_SPAWN_SETEXEC) and the disclaim attribute: same pid, same file descriptors, same session and controlling terminal, and the program becomes responsible for itself.

Everywhere but macOS, and wherever the binary did not call Enable (tests, other entry points), Wrap returns the command unchanged.

Index

Constants

View Source
const Arg = "__disclaim-exec"

Arg is the hidden first argument that turns the caprock binary into the re-exec trampoline: caprock Arg <path> <argv0> [args...].

Variables

This section is empty.

Functions

func Enable

func Enable()

Enable turns wrapping on for this process. Only a binary whose main calls Main first may call it, since Wrap points commands back at this executable. A no-op off macOS or when the executable cannot be found.

func EnableWith

func EnableWith(exe string) (restore func())

EnableWith is Enable with the binary named: exe must call Main first, as a test binary's TestMain can. It returns a function that restores the previous setting.

func Main

func Main()

Main runs the trampoline when the process was started as one, and returns at once otherwise. Call it first in main, before anything else starts.

func Wrap

func Wrap(name string, args []string) (string, []string)

Wrap returns the command to run in place of name args: the trampoline when wrapping is on and name resolves to an executable, name args untouched otherwise. A name that does not resolve is left alone so the caller's own start fails as before, with the same error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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