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
Security: data-integrity nits in consolidation and git-backup locking #69
Internal security audit, two low-impact integrity issues grouped.
4.1 STAGING path unescaping is asymmetric — Medium
scripts/run-consolidation.sh:89: staging paths from Python are extracted with
sed "s/^STAGING=//;s/^'//;s/'$//"
This undoes _shell_escape()'s outer single-quote wrapping but doesn't decode the '\'' idiom used for embedded single quotes. A staging filename containing a single quote produces a corrupt path — mv then points at the wrong file (or fails), leaving the memory file un-renamed to .done.md and re-processed indefinitely.
Not directly exploitable for code execution, but a data-loss path on filesystems where single quotes in filenames are valid.
Fix: write staging paths to a temp file (one per line, NUL-separated), and read with while IFS= read -r -d '' path; do .... Or move to JSON IPC alongside the broader safe_eval refactor.
Between rm and the noclobber re-acquire, another concurrent session can win the lock. Both then proceed.
Benign in practice — worst case is two concurrent commits to disjoint slug subtrees (which git serializes via its own index lock). Worth a code comment acknowledging the race + why it's acceptable.
Fix: add a comment, or use flock(1) on a separate lock file (no TOCTOU — flock is atomic). The latter is the structurally correct fix and removes the race.
Both are low-impact today. 4.1 is the one to actually fix; 4.2 is acknowledge-or-flock.
Activity
security: harden data integrity in STAGING parsing and git-backup lock (