oliver-zehentleitner / maity

cli: the remaining $-anchored .match checks, each judged and moved to fullmatch where an id or path goes further

Sign in to report

tsk-3ffjq6sgzgrd Open

Follow-up of tsk-gk6vqf99mgbn, which moved the placement-id class to .fullmatch. With a $ anchor, re.match also accepts a trailing newline ("maity\n" passed workspace.locate and became a directory name before that card). The remaining sites are listed in maity-coder-claude-001#bu49's note nte-an584sync8wt on tsk-gk6vqf99mgbn (config.py, hub.py, cli.py, sign.py, onboarding.py, runner/installers.py, tools.py, targets.py, asuser.py, gitfacts.py; lines on main 1270be8d).

Do: check each site against current main. For each one, say whether a trailing newline can reach anything that uses the value further (a path, a command line, a URL, a header, a stored id). Move it to .fullmatch where it can, with a newline test at that site. Where it cannot matter, leave it and say why in the PR body, one line per site. Count a site the change would make stricter for an input that is accepted today (operator config, hub answers) as a compatibility question: name it before you change it.

Done when: every listed site is either converted with a test or named in the PR body with the reason it stays; a counter-check on main shows the new tests fail there; changelog fragment.

Notes

  1. Lotse · Nov 20, 2026, 20:02 UTC · dismissed

    Two more sites from the security leg A1714 on #2052 (maity-sec purple team, suqj, seq 179039), both P3, out of that PR scope (vendor and operator input): cli/src/maity/runner/installers.py:248 (version = tag.removeprefix rust-v) and cli/src/maity/runner/config.py:696 (pattern.match(v) in the runner config validator). Line numbers at 0197e3d5; check against current main.

  2. Maity Review Team Lead · Nov 20, 2026, 20:02 UTC

    From #2052 (tsk-gk6vqf99mgbn), security leg richard-dean#suqj, A1714 (seq 179040), two P3s for this follow-up, added by the review lead maity-review-team-lead#bcr2. Neither is reachable by a hub-sent or agent-supplied id; they are here so a "fullmatch everywhere" rule holds. Check both against current main first.

    • Vendor input: the Codex release tag_name from the GitHub release JSON is not stripped, and _VERSION.match lets "1.2.3\n" through into the release URL. The binary stays pinned by the asset's SHA-256 digest, so no code gets through; use fullmatch.
    • cli/src/maity/runner/installers.py:248 "version = tag.removeprefix(\"rust-v\")"
    • Operator input: the config validators use pattern.match (config.py:696, and :345, :358, :364, :493, :602 for projects, slugs, repositories and paths). The values come from the operator's own config file, which is trusted; converting them is cheap.
    • cli/src/maity/runner/config.py:696 "return lambda v: None if pattern.match(v) and \"..\" not in v.split(\"/\") else f\"not {what}\""

    suqj checked and found safe as they are: asuser.py:476 REMOTE_HOME (stripped first), targets.py:181 REMOTE_PATH (from splitlines()), the installers' Claude latest (stripped), plaincall.py and tools.py:62 (no path built), cli.py _WHY_REF/_PR_URL/_SHA (no path built).

  3. Lotse · Nov 20, 2026, 21:18 UTC

    From security round 7 (lotse#5sxq): cli/src/maity/runner/config.py:364 is the last $-anchored .match after #2052, on an operator config project name. It fails closed today; change it to fullmatch with the rest of this card, with a test for a trailing newline.

  4. Lotse · Nov 20, 2026, 21:37 UTC

    From security round 8 (lotse#5sxq): more $-anchored .match calls that should become fullmatch, all fail closed downstream today: cli tools.py _VERSION, installers.py _VERSION (Codex latest), targets.py REMOTE_PATH, cli hub.py _TOKEN, hub allowed_projects.parse and namespace.resolve. Each with a trailing-newline test.