Skip to content

pkgs/id: .ssh-host-key (SSH host private key) gitignored nowhere — CWD-relative serve artifact one git add -A from commit #443

Closed

Description

@dezren39

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.rs load_or_create_host_key (~:86-97) — on first use it generates a fresh Ed25519 private key and persists it with crate::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/--new the file lands in the caller's working directory (a repo checkout for anyone developing or dogfooding inside this repo, and any in-repo --data-dir is likewise uncovered for this name).
  • Root .gitignore:117-123 protects 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-key has no entry in the root .gitignore or pkgs/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 .gitignore gains an unanchored .ssh-host-key entry beside the other pkgs/id entries (:117-123), so it is ignored at any depth.
  • git check-ignore -v matches .ssh-host-key at the repo root, in pkgs/id/, and in a nested directory; creating a dummy .ssh-host-key leaves git status clean.
  • Audit in the fix PR: enumerate the *_FILE / *_PATH / FILE_NAME constants in pkgs/id/src (KEY_FILE, CLIENT_KEY_FILE, STORE_PATH, SERVE_LOCK, ALLOWED_NODES_FILE in access.rs, SSH_HOST_KEY_FILE, event-store events.redb, groups groups.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-standard gains 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

  1. added a commit that references this issue on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions