Files
connector-popos/smoketest/README.md
T
davidandClaude Opus 5.5 fef73e8b5b Test the agent sandbox from inside; keep srt's settings out of /tmp
Ports CoreDesktop's security checks (05b13b2, d5925fa, 53c6c8b) as
smoketest/scenarios/80-security.sh:

- The sandbox: a fake opencode, Hermes and Cline Desktop, run through
  sandbox/bin's wrappers, can't read secrets or an SMB password through
  sudo, write outside their project (home, ~/.bashrc, ~/.local/bin,
  systemd units, autostart, the connector, its sandbox config or yours,
  the settings srt starts with, their project's git hooks and config),
  reach domains, LAN addresses or loopback servers that aren't allowed,
  or see other processes or the session's D-Bus. Each check also runs
  outside, so a pass means the sandbox blocked it.
- Root: what configure installs for root to run or read is root's alone
  and names no home folder, and with a security key and fingerprint set
  up, a password user's sudo still takes the password and only it.
- The install path: every hop from federated.sh/pop is HTTPS, and plain
  HTTP doesn't serve the script.

CoreDesktop's network exposure checks (ufw, Docker, sshd) don't apply.

Writing it found that sandbox/agent put the settings srt starts with in
/tmp/federated-sandbox when XDG_RUNTIME_DIR wasn't set, and every sandbox
can write /tmp, so an agent could put its own settings, or a link, where
the next one's go. They're now always in /run/user/<uid>, which no
sandbox can write, and it won't start without it.

The smoketest's runner gives each scenario what a login does: USER,
/run/user/<uid>, and the session bus in it, as on Pop!_OS.

PLAN.md: CoreDesktop compared at 4e9b962, everything that applies ported.
Neither lint nor the Docker smoketest has run on these ports yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 19:14:55 -07:00

7.8 KiB

Smoketest

These tests run configure's pieces on Ubuntu 24.04, which Pop!_OS 24.04 is built on, in throwaway Docker containers. A container has the same apt packages as Pop!_OS, except COSMIC's own, and /etc/os-release says Pop!_OS. Each scenario starts with what a login gives: USER, /run/user/<uid>, a session D-Bus in it and an unlocked gnome-keyring, as on Pop!_OS.

They check what lint can't:

  • GNOME Online Accounts 3.50 without GNOME
  • Ubuntu's restic, rclone, davfs2 and sshfs
  • mise's apt repository
  • the sandbox, with real downloads

Running it

smoketest/run --list                  # scenarios and their tier
smoketest/run                         # the quick scenarios
smoketest/run --tier all              # everything, including the downloads
smoketest/run 40-backup               # one scenario (or: smoketest/run 40)
smoketest/run --keep 20               # keep the container afterwards, to look around

It tests the working copy as it is, including uncommitted changes. The first run builds the image. Each scenario takes a few seconds plus its own apt installs; 50-sandbox downloads Node.js and srt, and runs with --privileged so bubblewrap can make user namespaces.

Each run writes its logs to smoketest/results/<time>/, one per scenario, and prints which scenarios passed.

Scenarios

Scenario Checks
05-install install.sh piped into bash, as curl | bash runs it, with the working copy. It installs a missing package again, links the commands, puts ~/.local/bin on PATH for a new bash, and doesn't ask to run configure without a terminal. update swaps in a fresh copy without leaving staging folders behind.
10-configure --help, --list (nothing on stderr; agent sign-ins and the sandbox item hidden until they apply), the menu, an unknown item, the Core item's first question, and refusing to run as root
20-goa goa-account with Online Accounts 3.50. It adds Nextcloud and email (quoting a name), adding again changes nothing, and it pauses email and ends the pause. Test a Core takes an unreachable mail server as a sign-in failure, not a wrong password. Removing leaves nothing in the keyring.
30-core-local Superpanel's entry, Element's config (in ~/.config, or the Flatpak's folder), and the COSMIC Files sidebar. The sidebar check reads and writes ron's pretty format with network places and escaped names, keeps COSMIC Files' defaults, and leaves a file it can't read alone. Then davfs2's secret, read back.
35-claude-notify system/claude-notify with a fake /proc and a stand-in notify-send: it names COSMIC Terminal, found among Claude's parent processes, or the Flatpak it runs in, shows the project folder and Claude's message, and names no app it has no desktop entry for. configure agents writes its hooks, swaps the old notify-send ones for them, keeps your own hooks and settings, and changes nothing the second time.
40-backup restic and rclone from apt, with rclone serve webdav standing in for Nextcloud and the secrets in the keyring. system/backup makes a snapshot that leaves out caches and the install, a file restores from it, and without the passphrase it fails.
45-tailnet lib/tailnet.sh with a stand-in tailscale: the other online computers, without phones; nothing when Tailscale is stopped or missing. configure ai-servers and configure storage ask the tailnet's machines as well as mDNS's, list a machine found both ways once by its tailnet name, and mount a tailnet server at /mnt/.
50-sandbox (all) Node.js and srt download and install. A stand-in agent can't read ~/.ssh or Federated Connector's settings, or write outside its project, reaches allowed sites only, and won't start in your home folder. A new bash finds the sandboxed command first.
55-hermes-homeserver Hermes' gateway reaches only a Matrix server you've allowed: a server in Hermes' settings is to do until configure hermes allows it, a wildcard or escape codes never count, and configure agents carries over the server an old drop-in allowed. edit_json fills an empty file from its default.
60-packages (all) davfs2 installs with mount.davfs setuid, and davfs2_ready fixes one installed without. sshfs' fusermount3 and smbclient are where configure storage expects them, and so is GTK's CUPS print backend. mise installs from its apt repository and a new bash has it.
70-sign-in configure security-key and configure fingerprint on copies of Ubuntu's sudo and polkit stacks, which start with @include common-auth: the line goes just before it, polkit gets its own copy and the vendor's is left alone, adding twice adds once, and stopping puts sudo back as it was. A FIDO2 key is found by its HID descriptor, a reader by its vendor (unless a driver claims it, like a touchpad) or its name.
75-taildrop-portal With a stand-in tailscale: system/captive-portal stops using an exit node behind a sign-in page and uses it again once online, unless you've picked another one. system/taildrop receives into Downloads and names the files in its notification. configure tailscale installs the Taildrop service and the dispatcher script, sees an old script as to do, and leaving removes the service.
80-security (all) Ported from CoreDesktop's security checks. The sandbox: a fake opencode, Hermes and Cline Desktop, run through sandbox/bin, can write in their project, /tmp and their own state, and reach allowed sites; each check below works outside and fails inside. They can't read secrets (SSH, GPG, the keyring, Bitwarden, the connector's settings, Online Accounts, Evolution, Element, davfs2, WinBoat) or an SMB password through sudo; write the home folder, other projects, ~/.bashrc, ~/.local/bin, systemd units, autostart, the connector, its sandbox config or yours, the settings srt starts with, or their project's git hooks and config; reach domains, LAN addresses or ports not allowed, or this machine's loopback; or see other processes or the session's D-Bus. Root: what configure installs for root is root's alone and names no home folder, and with a security key and fingerprint set up, a password user's sudo still takes the password and only it. The install path: every hop from federated.sh/pop is HTTPS, and plain HTTP doesn't serve the script.

What still needs Pop!_OS

A container has no COSMIC session, systemd user manager, FUSE mounts or AppArmor, so check these by hand on Pop!_OS 24.04:

  • COSMIC Files shows a folder added to its sidebar, with its name.
  • Evolution shows the email, calendars and contacts that configure core adds, against a real Core.
  • Mounting your files with davfs2 after configure core, and again after logging out and in.
  • The services: the backup timer, the email watcher's notification, and that clicking it opens configure core in COSMIC Terminal.
  • The AppArmor profile for bubblewrap, if Pop!_OS restricts user namespaces.
  • Tailscale joining a Core's headscale, and SMB and SFTP mounts of real servers.

Writing a scenario

A scenario is a bash file in scenarios/ that sets DESCRIPTION and TIER, either quick or all, and defines scenario. PRIVILEGED=1 runs its container with --privileged. It runs with what configure gives items: CONNECTOR, CONF_DIR, and confirm and confirm_yes, which always answer yes. So it can source an item and call its functions. The user pop has passwordless sudo. Checks, from lib/runner.sh:

Check
check "what" cmd... ok if the command succeeds; otherwise FAIL, with its output
check_not "what" cmd... ok if the command fails
check_eq "what" expected actual ok if they're the same
skip "why" Note something not checked
step "what" A heading

check runs its command in a subshell, so variables it sets don't last. Set those before the check.