Skip to content

NOW_DAY_FILE read at save-session.sh:1013 has the same FIFO-hang vulnerability #634 fixed for NDC_GEN_FILE, with no type-check guard #642

Closed

Description

@fdaviddpt

Found by PR #641's self-review (Explore + oss:auditor) while fixing #634, which added a regular-file type check to ndc_read_gen()'s read of NDC_GEN_FILE.

Symptom

A FIFO or character device placed at the path NOW_DAY_FILE names would hang save-session.sh indefinitely while it holds LOCK_DIR, exactly the same failure mode #634 fixed for the sibling marker.

Location

scripts/save-session.sh:1013 (pre-#634/#635-diff line numbering):

NDC_DAY=$(cat "$NOW_DAY_FILE" 2>/dev/null | tr -d '[:space:]')

No -f/-L or regular-file check guards this cat, unlike the now-fixed ndc_read_gen() (#634) and the original ts_marker_read() (#625) it was modeled on.

Mechanism

cat on a FIFO with no writer present blocks forever -- no O_NONBLOCK, no timeout anywhere in this script, the same hazard #634's own comment already documents at the sibling function. A character device (e.g. /dev/zero) would instead stream unboundedly into the command substitution.

What would settle it

Reproduced directly, not just reasoned: mkfifo dayfifo; timeout 3 bash -c 'cat dayfifo 2>/dev/null | tr -d "[:space:]"' exits 124 (timeout), confirming the hang. Fix: add the same [ ! -f "$NOW_DAY_FILE" ]-shaped regular-file check ndc_read_gen() now uses (post-#634), ahead of this cat.

Severity: local-only (whatever can place a FIFO/device at this path can already do worse), same reasoning as #634's own non-blocking classification. Row: fails-to-preserve.

[AI-generated, filed by the maintainer loop from PR #641's own self-review]

[AI-generated]

Activity

  1. added
    priority:low
    filed-by-loop
    lane-consolidation
    on Sep 10, 2026
  2. self-assigned this
    on Sep 10, 2026
  3. removed their assignment
    on Sep 10, 2026
  4. added a commit that references this issue on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    filed-by-looplane-consolidationpriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions