Skip to content

test(e2e): end-to-end test with sshd in a container and a fake Telegram - #67

Merged
groupsky merged 1 commit into
mainfrom
test/e2e
Oct 15, 2026
Merged

groupsky merged 1 commit into
mainfrom
test/e2e

Conversation

@groupsky

Copy link
Copy Markdown
Contributor

What

The end-to-end test of version 1 (test/e2e, build tag e2e): the real binaries against real OpenSSH, with throwaway keys and a fake Telegram server.

  • Setup: one container (pinned debian:bookworm-slim digest) runs 4 sshds with throwaway host keys: web-1 (Ed25519), web-2 (ECDSA), db-1 (RSA) and web-3, which is not in the broker's known_hosts. The real nodkey broker runs with nodkey keygen keys, a fake bws and a fake Telegram server (reached through HTTPS_PROXY and a test CA, so nothing reaches the real Telegram). Clients: nodkey run, nodkey ssh-agent with the real ssh and git, and nodkey ssh-grant.
  • Cases: nodkey run passes the secret into a command (the command proves it by a hash); nodkey run denied; an SSH login approved; an unknown host key refused with no message; ssh-grant covers exactly the listed hosts and that user; git over SSH (clone and push); an SSH login denied, and the Deny ends the grants; nodkey audit verify passes with every journal anchor (a changed copy fails).
  • Canaries: a planted secret (in many encodings and every 12-character part), the made-up tokens, and a second canary in a parent process's command line are searched in every log, the audit log, every call to the fake Telegram server and all client output. Nothing is found; the second canary appears only masked, in the message and the audit log, as DESIGN.md section 7 says. Every Telegram message must be an approval message.
  • Another user: internal/client's root-only test runs as root in a container: a process of another user is refused at the ssh-agent socket (SO_PEERCRED).
  • Safety of the test: containers with --cap-drop ALL (only what sshd needs), no-new-privileges, process and memory limits, ports on 127.0.0.1 only, no mounts; children get only the environment the test gives them; leftovers of a killed run are removed at the next start.
  • CI: a new e2e job on ubuntu-latest (pinned actions, contents: read, 20-minute timeout); lint also runs with --build-tags e2e. Dependabot keeps the base image digest current.

A run takes about 6 to 8 seconds once the image is built.

Docs

DESIGN.md section 17 (how the test works, how to run it, cleanup commands); AGENTS.md commands.

Review

Three rounds with the security-reviewer agent. The reviewer broke the code on purpose in a copy (a value in a log, masking off, a Deny that does not end grants, an alert with claimed text); the test catches every one.

Closes #15

The real broker, nodkey run, nodkey ssh-agent with real ssh and git, and nodkey ssh-grant, with throwaway keys; a canary search over every output; a CI job.

Closes #15
@groupsky groupsky added this to the v1 milestone Oct 15, 2026
@groupsky
groupsky merged commit 63c3c9d into main Oct 15, 2026
7 checks passed
@groupsky
groupsky deleted the test/e2e branch October 15, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

End-to-end test with sshd in a container

1 participant