Problem
From verification of #49:
「while IFS= read -r mdfile not null-safe to filenames containing newlines. find outputs newline-separated paths; could split. Hygiene fix: find -print0 + read -d ''.」
— Source: idd-verify #49 (security review LOW #1)
archive-mail.md Step 2.1 sibling-archive dedup extension uses:
while IFS= read -r mdfile; do
...
done < <(find -P "$symlink_dir/" -maxdepth 2 -name "*.md" -type f 2>/dev/null)
If a *.md file has a newline character in its filename (unusual but legal on Unix), the path will split mid-loop, causing partial filename to be processed.
Type
bug (hygiene)
Realistic exposure
Low. Apple Mail subject lines typically don't have raw newlines (they're collapsed during header serialization). But:
- Cross-platform paths from external archive sources might
- Manual
mv operations on archives with copy-paste-from-email could
- POSIX allows newline in filenames
Priority
LOW — defensive hygiene fix.
Strategy sketch
Standard null-safe pattern:
while IFS= read -r -d '' mdfile; do
...
done < <(find -P "$symlink_dir/" -maxdepth 2 -name "*.md" -type f -print0 2>/dev/null)
Diff:
find adds -print0
while IFS= read -r becomes while IFS= read -r -d ''
Same change should apply to outer find (find -P "${output_dir}" -maxdepth 1 -type l -print0).
Priority again (with mitigation)
LOW (no realistic case for archive-mail's typical inputs) but trivial to fix and improves defensive posture.
Related
Problem
archive-mail.mdStep 2.1 sibling-archive dedup extension uses:If a
*.mdfile has a newline character in its filename (unusual but legal on Unix), the path will split mid-loop, causing partial filename to be processed.Type
bug (hygiene)
Realistic exposure
Low. Apple Mail subject lines typically don't have raw newlines (they're collapsed during header serialization). But:
mvoperations on archives with copy-paste-from-email couldPriority
LOW — defensive hygiene fix.
Strategy sketch
Standard null-safe pattern:
Diff:
findadds-print0while IFS= read -rbecomeswhile IFS= read -r -d ''Same change should apply to outer find (
find -P "${output_dir}" -maxdepth 1 -type l -print0).Priority again (with mitigation)
LOW (no realistic case for archive-mail's typical inputs) but trivial to fix and improves defensive posture.
Related