Skip to content

--repo "" silently targets the working directory and writes to it #34

Description

@jordonpeterson

Severity: high. Found by an adversarial-operator user test. Pre-existing.

An empty --repo falls through to the flag's default (.) rather than being rejected — the unset-variable bug every fleet script eventually has.

Repro

cd /tmp/cwdvictim
REPO=""                       # e.g. REPO=$(lookup_repo "$name") returned nothing
cot sync --repo "$REPO" --op 'add_owner(important.txt, @attacker/team)'

Observed: exit 0, and cwdvictim/.github/CODEOWNERS is modified. The emitted record carries "repo":"", so results.jsonl gets a success row that does not say which repository was changed.

A typo'd path fails correctly. The empty string is the one wrong value that gets a default instead of an error — and it is the value a shell produces by accident.

Suggested fix

Reject --repo "" at argument-parsing time (exit 3, repo-independent). . remains the default when the flag is absent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions