Repository navigation
Description
What
scripts/lib-memory-dir.sh's no-jq Python-fallback branch signals an untrusted-project-config
drop via a marker file (its own stdout/stderr are already redirected to /dev/null by the
caller, so they cannot carry a signal). If the mktemp call that creates THAT marker path itself
fails (a full or read-only $TMPDIR), the drop can happen with nothing logged -- reproducing, in
this one compound case, the exact silent fail-closed defect #748 fixed elsewhere.
Location
scripts/lib-memory-dir.sh:622:
_project_drop_marker=$(mktemp "${SYS_TMPDIR}/remember-config-drop-marker-XXXXXX" 2>/dev/null) || _project_drop_marker=""
Mechanism
When this mktemp fails, _project_drop_marker is empty. The Python subprocess then receives an
empty drop_marker_path argument, and its own if drop_marker_path: ... guard skips writing the
marker even when the untrusted project layer ALSO fails to load in that same invocation -- so the
drop happens with nothing logged. This needs BOTH mktemp and the project config to fail in the
same run to trigger, so it is a doubly-rare compound case, not the common path.
The code's own comment at this line already states the general tradeoff as deliberate: "tolerated
the same way every other mktemp-failure path in this file is (fall through, don't crash the merge
over the logging side-channel itself)" -- every OTHER mktemp call in this file (the sanitize
temp file, the merged-config temp file) accepts the identical silent-fallthrough shape on its own
mktemp failure, so this is not an isolated oversight so much as a known, accepted-elsewhere
pattern applied here too.
Why not fixed alongside #748
Found by the oss:auditor self-review during #748's own lane; ranked fails-to-preserve,
non-blocking, "can ship behind a trap.d fragment." Logged as
trap.d/748.marker-signal-dies-if-mktemp-fails.md. Still true at HEAD as of this curation pass
(2026-09-26).
What would settle it
Undecided, and worth a maintainer call rather than a guessed fix: whether a compound failure this
rare is worth a SECOND, independent signal (e.g. checking the Python subprocess's own exit code in
addition to the marker file, so a failure disclosure never depends on a second filesystem operation
succeeding), or whether the existing "every mktemp failure in this file is tolerated the same way"
precedent already covers it and this is working as designed.
[AI-generated]
Activity
fix(#804): give the no-jq drop-marker a second signal independent of …
curate: 8 trap.d fragments -- 1 promote, 1 merge, 6 decline (#807)
fix(#815): fold the #815 divergence pair into #804's, don't stack bes…
fix(#815): disclose a malformed TRUSTED config layer, matching #804's…
fix(#825): scrub the real path/username PR #824 reintroduced into two…
fix(#898 round 4): replace every typed here-document with a here-string
refactor(#898): one _lmd_warn helper for lib-memory-dir.sh's drop war…
fix(#898): release tree scrub + 5 new guards (typed-heredoc shipped a…
fix(#900): compile hooks.json-registered hooks self-contained at buil…