feat(cli): escape control characters from mail, refuse the token over plain http

- printable() shows C0, DEL and C1 control characters (except tab and newline; CRLF counts
  as a newline) as \xNN / \uNNNN, applied to every table cell, archive show, member
  listings, import reports and error text, so an escape sequence in a subject cannot
  drive the terminal.
- The client refuses to send the bearer token over http:// to a non-loopback host unless
  --insecure is given: usage error, exit 2. localhost, 127.0.0.0/8 and ::1 stay allowed.
  Offline commands (dkim) never build the client, so they are not affected.
- Tests: the helper, ESC sequences in archive ls/show, held ls, queue ls, list/member names,
  API errors and import reports; the URL check by flag and PARSIMONY_URL. README updated.
This commit is contained in:
tgiachi 2026-11-10 11:57:58 +01:00
commit eccd82af69

View file

@ -70,6 +70,10 @@ parsimony help
`<list>` is an address or a numeric id. Destructive commands (`list rm`, `archive rm`) need `--yes`.
Exit status: 0 success, 1 failure (including lines that failed in `member import`), 2 usage error.
The client refuses to send the token over plain `http://` to any host other than `localhost`, `127.0.0.1` or `::1`
(usage error, exit 2): put the API behind HTTPS, or pass `--insecure` if you really mean it.
Subjects, senders, message bodies and error texts that come from mail are printed with control characters
(escape sequences) shown as `\x1b`-style text instead of being sent to the terminal; `--json` output is already escaped.
`parsimony serve -config FILE` runs the daemon; the old `parsimony -config FILE` form still works.
In the container: `docker exec parsimony /parsimony list ls`.