Repository navigation
Description
Summary
id serve with SSH enabled creates .ssh-host-key — the SSH host private key — as a bare CWD-relative file, and it is gitignored nowhere. Every sibling server-key/data file is protected repo-wide (.iroh*, .identity.db/.redb, events.redb, groups.jsonl, .id-worlds/); this one was left out. It is the #420/#432/#439 hazard shape, but the payload is a secret key, not data.
Evidence (on main f3ab579f)
pkgs/id/src/world_ssh.rs:31—pub const SSH_HOST_KEY_FILE: &str = ".ssh-host-key";("File, beside the other server keys, that holds the SSH host key.")pkgs/id/src/world_ssh.rsload_or_create_host_key(~:86-97) — on first use it generates a fresh Ed25519 private key and persists it withcrate::store::write_private_file(path, pem).pkgs/id/src/commands/serve.rs:1041-1043— serve passes the bare constant (no directory join) when an SSH port is configured.pkgs/id/src/main.rs:82-87— all data paths are CWD-relative by design; without--data-dir/--newthe file lands in the caller's working directory (a repo checkout for anyone developing or dogfooding inside this repo, and any in-repo--data-diris likewise uncovered for this name).- Root
.gitignore:117-123protects the whole sibling family at any depth:.iroh*(:117 — covers.iroh-key,.iroh-key-client,.iroh-store,.iroh-serve.lock,.iroh-allowed),.id-worlds/(:118),.identity.db(:119),.identity.redb(:120),events.redb/events.redb.tmp(:121-122),groups.jsonl(:123)..ssh-host-keyhas no entry in the root.gitignoreorpkgs/id/.gitignore.
Reproduced with origin/main's own .gitignore files in a scratch repo: git check-ignore -v .ssh-host-key (at repo root, pkgs/id/, and sub/deep/) exits 1 — NOT IGNORED — and the files show as ?? in git status; the controls .identity.redb and events.redb match .gitignore:120/:121 as expected.
git ls-tree -r origin/main | grep ssh-host is empty — the file is not tracked yet, so no git rm --cached is needed; this is purely preventive, like #439.
Why it matters
host_key_fingerprint (world_ssh.rs) is the trust-on-first-use check SSH clients rely on. Committing this file — one git add -A after a single SSH-enabled serve run from a repo directory — publishes the host private key, letting anyone impersonate the host to every client that pinned its fingerprint. The file is mode-restricted on disk (write_private_file), but git does not care about that.
Acceptance criteria
- Root
.gitignoregains an unanchored.ssh-host-keyentry beside the otherpkgs/identries (:117-123), so it is ignored at any depth. git check-ignore -vmatches.ssh-host-keyat the repo root, inpkgs/id/, and in a nested directory; creating a dummy.ssh-host-keyleavesgit statusclean.- Audit in the fix PR: enumerate the
*_FILE/*_PATH/FILE_NAMEconstants inpkgs/id/src(KEY_FILE,CLIENT_KEY_FILE,STORE_PATH,SERVE_LOCK,ALLOWED_NODES_FILEin access.rs,SSH_HOST_KEY_FILE, event-storeevents.redb, groupsgroups.jsonl, and the world files under.id-worlds/) and confirm each is covered after the change — this file should be the last gap. - No tracked file becomes ignored (
git ls-files -ci --exclude-standardgains no entries).
Single-repo: world_ssh.rs / .ssh-host-key exist only in this repo (grep-verified absent from developing-today/opencode, developing-today/openchamber, dezren39/nix).
Activity
Merge pull request #444 from developing-today/creator/443-ssh-host-ke…