oliver-zehentleitner / maity

runner config: every pattern that guards a value sent to the hub or a command line matches the whole string (no trailing newline)

Sign in to report

tsk-3jzeck5m208a Done An agent

Found in #2090 (d4kb A1994, bcr2 seq 191015). The effort pattern in cli/src/maity/runner/config.py is fixed there (whole string, cap 16), but pre-existing patterns on main still use a caret-dollar pattern with re.match, where the dollar also matches before a final newline: SLUG (:64), FULL_NAME (:66), REPOSITORY (:68), REMOTE_USER (:663), REMOTE_PATH (:664) and the PATH pattern (:691). A value with a trailing newline passes the config check. Where it reaches the hub hello, the hub answers 400 and serve exits 78 (the whole runner stops reconciling); where it reaches an ssh or shell command line, a newline is worse. Done when: every such pattern uses fullmatch or the \\A...\\Z anchors (ideally one helper in config._strings), each with a test that a trailing newline is refused at config load with a clear message, and the reviews note which values reach the hello or a command line. Legs: two vendors plus suqj (the remote ones reach ssh). After #2090, not inside it.

Notes

  1. Maity Review Team Lead · Nov 21, 2026, 17:51 UTC

    Scope from suqj A1997 (seq 191040, on #2090 at d8f36206). Every runner-config pattern that uses ^…$ with .match lets a trailing newline through. Anchor them all with \A…\Z (or use fullmatch):

    • config.py:64 SLUG, :66 FULL_NAME, :68 REPOSITORY;
    • :663 REMOTE_USER, :664 REMOTE_PATH, the PATH pattern at :691;
    • and HOST_ADDRESS, which was not on the original list.

    Effect today (suqj): P3, availability only, with no injection.

    • SLUG, FULL_NAME and REPOSITORY reach the hub's hello. The hub refuses a newline, the hello is refused as a whole, and serve exits 78.
    • REMOTE_USER and HOST_ADDRESS are one ssh argv element; a newline makes the connection fail.
    • REMOTE_PATH and PATH are shell-quoted per word (targets.py:77).

    Add a test per pattern, as #2090 did for efforts (test_harness_efforts), and refuse at config load.

  2. Maity Review Team Lead · Nov 21, 2026, 18:24 UTC

    Keep the Why entry for this card, proposed by jc4h A1993 on #2090 (seq 191377); lotse asked for it here (seq 191384). It goes in cli/context/runner.md, extending 16f71263 or as a new entry.

    • Text: Every runner-side check that mirrors a hub shape matches the whole string (fullmatch, or \A…\Z) and mirrors the hub's count bounds. Python's re.match with ^…$ accepts a trailing newline that pydantic's pattern refuses, and a hello the hub refuses keeps the whole runner from connecting, not just the one harness. An empty option value on the command line is a usage error checked before any session, never a silent "default".
    • Reason: A1993, A1994 and A1996 on #2090 found the runner check accepting values the hub refused, and an empty --effort dropped silently.
    • Rejected alternative: relying on the hub's answer to surface it. That only comes at serve time, as a refused hello for the whole runner.