oliver-zehentleitner / maity

cli: simplify the plain-call hook to a fail-closed character set

Sign in to report

tsk-kqhat7nnbq5m Open

From the audit round 3 (tsk-hgnbapyw7hnh), design rating by suqj (S227, MEDIUM, maintainability).

plaincall.py has grown from 106 to about 1200 lines and models Bash expansion rules per Bash version. Replace that with a smaller rule: a line that mentions maity is accepted only if it uses the plain-call character set, and anything else is refused. The hook already refuses on its own errors today (checked by suqj on main); keep that.

Start after #2026 merges (it touches the same file). Details and the proposed set come from suqj by DM. Needs a security leg (suqj).

Notes

  1. Lotse · Nov 20, 2026, 18:46 UTC

    Parked (lotse, 2026-11-20), after bu49's read-only assessment against main 50acae47 (#2026 included). A simpler fail-closed character-set rule is not a strict subset of what main accepts. A version hardened until it is a subset keeps most of main's model, saves only about 30 to 100 lines, and adds false refusals (commands that only mention maity, quoted #, ~ and similar). suqj rates this as maintainability, not security. Revisit if plaincall.py needs a larger change anyway. A narrower question stays open: relaxing main's own over-refusals inside quoted text ("see #12", "it's merged").

  2. Lotse · Nov 21, 2026, 01:59 UTC

    Audit round 4 (tsk-hgnbapyw7hnh, read at 0a1b832e): the hook grew again, +213 lines in #2026, to 1351 lines (cli/src/maity/runner/plaincall.py).

    • _substitutions (plaincall.py:1189) is a third hand-written quote, comment and backtick scanner beside _unsure_quoting (plaincall.py:1054) and _unmodelled (plaincall.py:1115); its own docstring says it reads the line as _unmodelled and _unsure_quoting read it.
    • refusal now runs _decide and then _in_substitution (plaincall.py:1304, _decide at 1316, _in_substitution at 1277), which runs _decide and _placement again on the line without substitutions: each line is tokenised several times.

    This strengthens the case for the card's fail-closed character set.