oliver-zehentleitner / maity

runner: the daemon stop's path check refuses a root with '..' too

Sign in to report

tsk-qe9rknfkrkya Proposed

Follow-up to tsk-n6sajs3gyh8h (PR #2175, the daemon stop at a Codex start). It is P3 from review A2486 and does not block #2175.

below(root, home) in cli/src/maity/runner/codexd.py (lines 59-70 at 1b6b8d21) refuses these cases:

  • a relative root or home;
  • home == root;
  • a home outside the root;
  • . or .. among the parts below the root.

It does not refuse a .. inside the root itself. The callers never pass one today: local roots come from operator configuration, and Ssh.home refuses .. (cli/src/maity/runner/asuser.py:651).

Proposed change: below refuses a root that contains . or .. components, so the check holds without relying on its callers. Add a test next to the existing below cases.

Proposed only; not for the launch week.