Skip to content

Data dir override: refuse a parent directory chain that other users can modify (Unix) #1750

Backlog

Description

@smart-ssh-planner

Goal

A data directory override is also refused when a directory in the parent chain of the pointer file or data directory can be replaced by another local user.

Context

Follow-up of #1717 (PR #1734): only the pointer file, its immediate trust and the data directory itself are checked (data_dir_trust.rs:79-148). If a parent is writable by others (e.g. a world-writable folder without sticky bit), another user can rename the parent and substitute their own content, similar to sshd's StrictModes. Spec 0115 §4.1 defines the current rules.

Requirements

  • On Unix, walk the ancestors of the data directory and of the pointer file up to the root. Refuse an ancestor that is group/world-writable without the sticky bit, or not owned by the current user or root.
  • Do not refuse the system root hierarchy that is standard (/, /home, /tmp with sticky bit).
  • Windows is out of scope (separate issue); state this in the spec.
  • Reason strings name the offending ancestor.

Acceptance Criteria

  • A writable-by-others parent without sticky bit is refused with a reason naming it
  • A sticky-bit parent such as /tmp is accepted
  • A parent owned by another non-root user is refused
  • Normal default locations (home directory) still start
  • Spec 0115 and THREAT-MODEL.md describe the rule; changelog fragment added
  • Relevant automated tests pass (with counter-proof)

Technical Notes

Security-critical path. Unix only. Use lstat-style metadata; symlinks in ancestors are resolved first (canonicalise) and the resolved chain is checked.

Files: crates/persistence-sqlite/src/data_dir_trust.rs, crates/persistence-sqlite/src/data_dir_trust/tests.rs, docs/specs/0115-datenverzeichnis-override.md, THREAT-MODEL.md, changelog.d

Spec impact: update 0115

Open questions

  • Check ancestors up to root or only up to the home directory: recommended up to root with the sticky-bit exception. Alternative: stop at the home directory.

Related Work

Activity

  1. added
    follow-up
    on Dec 5, 2026
  2. smart-ssh-coder commented on Dec 5, 2026

    @smart-ssh-coder
    Contributor

    Needs maintainer: The issue waits for #1733, but "blocked by" could not be set. Set it on the issue (Relationships), then remove needs-maintainer: The code this issue extends (crates/persistence-sqlite/src/data_dir_trust.rs from #1734) exists only on release/0.8.0; it reaches develop with the open back-merge PR #1733. Nothing to attach the ancestor-chain check to on develop yet.

  3. added
    needs-maintainer
    question-triage
    and removed
    question-triage
    needs-maintainer
    on Dec 5, 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

    follow-uppersistencesecurity

    Fields

    Priority

    P3 - Low

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions