Expand description
Private mutable state beneath ~/.trusty-code/ (#5426, epic #2892).
Why: transcripts, logs, compression telemetry, daemon discovery files, and
channel cursors are per-user runtime state, not project configuration. They
were already landing in ~/.trusty-code via workstreams::default_data_dir,
but nothing named that directory as PRIVATE and nothing set its mode, so a
default-umask machine left 0755 — world-readable transcripts of whatever
the harness was asked to work on.
What: private_state_dir_at is the hermetic resolver (an explicit $HOME,
so tests never touch a real home directory and never mutate the environment);
private_state_dir is the production wrapper.
ensure_private_state_dir_at creates the tree and TIGHTENS the mode to
0700 on Unix — including on a directory that already existed with a
permissive mode, since the common case is an upgrade over an existing
~/.trusty-code. is_restrictive is the predicate the tests and the
tcode config paths diagnostic both assert on.
Test: paths::private_state_tests::*.
Constants§
- NON_
OWNER_ BITS - The permission bits that must be clear for a directory to count as private.
- PRIVATE_
DIR_ MODE - The Unix mode private state is held at: owner-only, no group, no other.
Functions§
- ensure_
private_ state_ dir - Create and tighten the production
~/.trusty-code. - ensure_
private_ state_ dir_ at - Create the private state directory and tighten it to owner-only.
- is_
restrictive - Whether a directory’s permissions keep it private to its owner.
- private_
state_ dir - Resolve the production private state directory,
~/.trusty-code. - private_
state_ dir_ at - Resolve the private state directory beneath an explicit home directory.