mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 19:56:53 +00:00
ffed838bc7moved `container exec -e NAME=VALUE` out of the host argv. This is the other half of the same leak: a credential handed to the program as a flag, `--password {{ … }}` or `-p {{ … }}`, renders into the argv of the host-side process just the same. 17 sites in 9 roles now pass `-e NAME`, bind the value in the task's `environment:`, and wrap the in-container command in `sh -lc` so the container's shell expands it rather than the host's. Two of them do better: the stalwart curl calls take their credential from a `curl -K -` config on stdin, the form jmap_call.yml in the same role already used, which reaches no argv at all. joomla's installer forwards all eleven values, free text included, so its wrapper holds no Jinja and cannot be broken by an apostrophe in a site name. Three rules keep the class out. container-exec-env-value takes `-e NAME=VALUE` with an interpolated credential; container-flag-credential takes the flag form, keyed on the value rather than the flag name, because `-p` is parents to mkdir and a vhost to rabbitmqctl; container-env-host-expanded takes the half-fixed shape that passes both of the others. That third rule earns its place:23e642a3f3left gitea and mattermost carrying `-e NAME` and an `environment:` with no wrapper, so the host shell expanded "$NAME" itself and wrote the plaintext back into the exec's argv. It renders, it parses, and the two sibling rules see nothing wrong with it. Every site was rendered, shell-checked and executed against a stub container that records its argv, with passwords carrying a space, an apostrophe, a double quote and a dollar; the pre-change commands leak the sentinel into the host argv and the post-change ones do not. Each rule has its own negative control. What remains: with `sh -lc` the secret still appears in the argv of the process inside the container, which host /proc can read. Only the two stdin sites are free of that. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>