--- name: coredesktop-security-checks description: Plan and progress for CoreDesktop's security test suite. All six steps are written and pass: the report receiver, report's redaction, and in the smoketest VM (smoketest/scenarios/60-security.sh) the agent sandbox, network exposure, what root runs and the install path. A few follow-ups remain. Use when resuming, checking the status of, extending or changing CoreDesktop's security or penetration tests. --- # CoreDesktop's security checks Written on 2026-11-16; all six steps were done the same day. Work out the current state before doing anything: ``` git -C ~/Projects/coredesktop fetch && git -C ~/Projects/coredesktop log --oneline origin/main -15 ls ~/Projects/coredesktop/smoketest/scenarios/ ~/Projects/coredesktop/server/report-receiver/ ``` Tell the user what's left (the follow-ups below) and confirm before starting any of it. ## Scope The suite covers what CoreDesktop itself adds. It doesn't test Arch or GNOME, which upstream looks after. It goes after the places where a mistake would leak data or give away control, in this order: 1. The report receiver, the only part on the public internet. **Done.** 2. `report`'s redaction, which decides what leaves a user's computer. **Done.** 3. The agent sandbox: the one place that runs code CoreDesktop doesn't trust. **Done.** 4. Network exposure from outside. **Done.** 5. Files root runs, and secrets only root may read. **Done.** 6. The install path (federated.sh, the `[federated]` repo). **Done.** The pacman guard (`system/pacman-guard`) is a safety net against mistakes, not a security control: anyone with sudo gets past it by design. Don't test it as a boundary. ## Done: steps 1 and 2 (the commit "Test the report receiver and redaction against attacks") - `server/report-receiver/test_security.py` sends the receiver what an attacker could. It found, and the commit fixed: - a negative Content-Length (read without limit) - parts nested thousands deep (RecursionError, connection dropped) - thousands of parts (8 s of CPU for 5.7 MB) - a rate limit per IPv6 address instead of per /64 - Markdown in report fields reaching the Gitea issue: @mentions, issue references, links, tracking images - no guard against filling the disk - `tests/report.bats` (the "Redaction" section) found `report` sending: - passwords in URLs - tokens, API keys, Nextcloud app passwords and private keys - IPv6 and MAC addresses - the Core's domain and the user's name - user and host names with regex characters, unredacted All fixed. A test also checks it doesn't over-redact (pacman's `::`, times, epoch versions, `std::string`). - Each test was checked to fail against the code before the fix. The new `receiver.py` was deployed on federated.sh on 2026-11-19 (server/report-receiver/README.md, "To update it later"). Still open from these steps: - **Slow uploads.** Caddy streams them to the receiver, one thread each. Try `request_buffers 11MB` in Caddyfile.example's `reverse_proxy`, and check that `caddy validate` accepts it. - **Gitea attachments.** Check on the real server that Gitea serves attached `.log` files as text or as downloads, never as HTML (a log can contain `