oliver-zehentleitner / maity

runners and placements (bug): the runner's remote clone listing uses GNU-only find -printf and walks .git without a limit

Sign in to report

tsk-1xv8fjfzbh93 Open

From the clean-up audit tsk-hgnbapyw7hnh, Area 9 (Runners and placements), read at 80647565. Every line number is at that SHA; check it against current main first. This is audit finding 21, filed on its own because its main part is probably a bug. Paths are under cli/src/maity/.

What is wrong

  • GNU-only listing over ssh (likely bug). The remote branch of AsUser.tree runs find -printf (runner/asuser.py:167). -printf is GNU-only, against the module's own rule at runner/asuser.py:116-118 ("only tools BSD, macOS and GNU share"). On a BSD or macOS ssh host, every start would probably fail as not_a_plain_clone. Not reproduced on such a host.
  • No limit while walking. clonecheck.py:121-142 (bounded_tree) stops after TREE_MAX+1 entries. Under the runner, AsUser is passed as the Files object (runner/supervisor.py:901, runner/operate.py:225). AsUser.tree (runner/asuser.py:149-172) walks everything, and only then does clonecheck count. A clone with a huge .git is walked in full on every start before it is refused.
  • Duplication. clonecheck.py:148-159 (Local.exists / read) duplicates AsUser's direct branch (runner/asuser.py:134-138, 188-192).

Proposal

  • Give AsUser.tree the same limit: bounded_tree when direct; over ssh, a listing that uses only POSIX find options (for example one find per entry type with -type d, -type f, -type l, and no -printf), cut off after TREE_MAX+1 entries.
  • Let clonecheck's LOCAL be the runner's AsUser (direct), so the two direct branches become one.
  • Tests: a fake remote whose find refuses -printf still lists the clone; a .git with more than TREE_MAX entries is refused without a full walk.

Order

  • tsk-ydxv7x37fg08 (done) changed what clonecheck accepts under .git; this card does not touch those rules. tsk-090wm1dqx6y3 (docs: git under maity) describes the clonecheck refusals; no conflict, but the docs should not name a GNU requirement for ssh hosts.
  • The runner supervisor clean-up card adds AsUser.remove_file() in the same module; rebase rather than conflict.

Covered elsewhere

  • None. Searched: printf, bounded_tree, asuser, macOS, not_a_plain_clone.

Effort S-M (counted as M). Risk medium (portability: the remote listing must give the same result on GNU, BSD and macOS).