You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lib-memory-dir.sh and lib-env-cache.sh carry the same predictable-tmp truncation class #427 fixed, and one of them writes a config that can hold an OAuth token #429
Reported by lane 427's self-review while fixing the same class in scripts/doctor.sh. Out of that lane's scope, so it is filed rather than fixed there.
Symptom
A pre-seeded symlink at a predictable path in a shared temp directory is opened and truncated as the invoking user. scripts/lib-memory-dir.sh then writes a merged config to that path -- and per its own adjacent comment that config can carry haiku.oauth_token, a live credential. So the exposure is not only truncation of an attacker-chosen file; it may also place credential-bearing content at an attacker-chosen destination.
Location
scripts/lib-memory-dir.sh:274 (and the mktemp/umask-then-write path at :274-278)
scripts/lib-env-cache.sh:80 and :194-195 -- the later (umask 077; : > "$_t") shape
Both are reached from nearly every entry point: doctor.sh sources lib-memory-dir.sh in its --json branch, and save-session.sh and the hooks resolve paths through the same chain.
Mechanism
The shell follows symlinks when opening a redirection target and truncates on open, before any byte is written or read. umask 077 constrains the mode of a file the shell creates; it does nothing about a path that already exists as a symlink. Lane 427's reproduction of the bare class:
bash -c '(umask 077; : > /tmp/pocdir/link)'# link -> victim.txt# victim.txt is now 0 bytes
#427 fixed exactly this shape in doctor.sh by routing both sites through mktemp, matching save-session.sh's existing convention. These two files were not in that lane and were not touched.
Ranking is deliberately left open. The truncation half is the same shape the round-one release audit called unranked for doctor.sh. The credential half is not the same finding: if a merged config carrying haiku.oauth_token can be written to an attacker-chosen path, that is discloses, which the ranking table marks blocking. Whether the write actually reaches the symlinked destination -- rather than failing or landing elsewhere -- is the fact that decides which, and it is not established here.
What would settle it
Trace whether lib-memory-dir.sh's merged-config write can land at a symlink's target with the token in it, or whether an intermediate step defeats that. If it can, this is a blocking row and the 0.24.0 tag waits on it too. If it cannot, it is the same truncation class as #427 and the fix is the same: route every temp path through mktemp, and let #427's class-pin test (test_no_script_builds_a_shared_tmpdir_path_from_pid) cover these files once it lands.
Activity
fix: lib-memory-dir.sh and lib-env-cache.sh no longer build a shared-…
fix: give #429's sanctioned-divergence guard a third state so it surv…
fix: origin/main is now fetched on pull_request runs, and the #442 gu…
fix: #455 -- swap the new mode probe's stat order to GNU-first, match…
fix: ten stale "0600 per PID" comments/docstrings, made false by #429'…
Teach the #440 unit tests the list-of-allowances shape 80b8013 gave _…
Make SessionStart's Python probe lazy, and drop always-on forks in me…
fix(#695): force byte-wise bracket ranges, scoped to the functions th…
fix(#695): force byte-wise bracket ranges everywhere, and pin it with…
fix(#722,#724,#726): update the byte-pin guard's stale sanctioned-div…
fix(#722,#724,#726): escape placeholder tokens, sandbox the nested su…
fix(#734): drop the #662 sanctioned-divergence tuple stranded by #726'…
fix(#740,#744): sanitize the untrusted project layer with a Windows-p…
fix(#740): strip haiku from every document of an untrusted project co…
test(#898): fix 4 CI-red scanner/divergence tests broken by round 2 l…
fix(#898): release tree scrub + 5 new guards (typed-heredoc shipped a…
fix(#900): compile hooks.json-registered hooks self-contained at buil…