Skip to content

docs(adr): draft ADR-0016 -- Phase 1 service-account UID model - #27

Merged
gonzafg2 merged 2 commits into
mainfrom
adr/0016-phase-1-service-account-uid-model
Jun 10, 2026
Merged

gonzafg2 merged 2 commits into
mainfrom
adr/0016-phase-1-service-account-uid-model

Conversation

@gonzafg2

Copy link
Copy Markdown
Owner

Summary

Operational counterpart to RFC-0002. The RFC documents the threat-model side: §2.5 "Phase-bounded reality" + §8.12 "Per-user UID isolation until Phase 3". This ADR documents the operational side: which OS identity actually executes the SSH-supplied command on a Phase 1 host.

The decision: run quantumsshd as a dedicated non-root service account (quantumssh:quantumssh) from PID 1. No privileged window, no setuid/setgid/initgroups/chroot machinery, no PAM, no passwd resolution. The audit field executing_uid (added by RFC-0002 §2.7) is populated by nix::unistd::Uid::current(); in Phase 1 the value is a per-process constant and the schema is forward-compatible with Phase 3's per-user value.

Why a separate artefact

RFC-0002 §"Why not bundle this with a 'single-command execution' ADR" explicitly defers the operational decision to a separate ADR. The RFC's job is the threat-model consequences (what the model promises, what it does not); the ADR's job is the concrete OS-level posture that makes those consequences honest. One-decision-per-file per the convention codified in PR #25.

Why Draft

This PR is opened as a Draft because it depends on the merge of PR #24 (RFC-0002). Mark it ready-for-review once PR #24 lands and the citations in this ADR resolve.

Status path

  • Today: Proposed.
  • When PR docs(rfc): draft RFC 0002 -- Phase-1 UID model and non-goal §8.12 #24 merges: ready-for-review here, then mergeable once the comment period and review settle. ADR remains Proposed because Phase 1 implementation has not begun (workspace has no members yet per ADR-0009).
  • When the first Phase 1 implementation PR lands: Status field updates from Proposed to Accepted with the Date field set in the same commit.

Alternatives considered

Five options are recorded in Alternatives considered:

  1. Run as root forever — rejected (Phase 1 needs no root).
  2. Run as root, drop post-spawn — rejected (the privileged window has no justification).
  3. Run as non-root service account from PID 1 — chosen.
  4. Per-user UID isolation in Phase 1 — rejected at the RFC level.
  5. CAP_SETUID + CAP_SETGID on Linux — same Phase 1 reasoning as (4); may resurface inside the Phase 3 RFC.

Test plan

  • Diff review of the two files: docs/adr/0016-phase-1-service-account-uid-model.md (new, 96 lines) and CHANGELOG.md (one new bullet under Added).
  • Verify the Status / Date / Deciders / Related fields follow the convention in docs/adr/0000-template.md.
  • Confirm citations to RFC-0002 §2.5, §2.7, §8.12 resolve once PR docs(rfc): draft RFC 0002 -- Phase-1 UID model and non-goal §8.12 #24 lands.
  • Confirm ADR-0009 link (workspace-no-members) resolves — it does in main today.
  • CI green (workspace-state guards remain self-disabled per ADR-0011).

gonzafg2 added 2 commits May 26, 2026 22:39
Records the operational counterpart to RFC-0002. The RFC documents
the threat-model side (§2.5 Phase-bounded reality + §8.12 non-goal);
this ADR documents the operational decision RFC-0002 §"Why not bundle
this with a 'single-command execution' ADR" explicitly defers to a
separate artefact: which OS identity executes the SSH-supplied command
in Phase 1.

The decision is to run quantumsshd as a dedicated non-root service
account from PID 1 — no privileged window, no setuid machinery, no
PAM, no passwd resolution. Three other options were on the table
(root forever, root + post-spawn drop, CAP_SETUID); each is recorded
in Alternatives considered with why it was rejected.

Status: Proposed. Advances to Accepted when Phase 1 implementation
begins. Depends on the merge of PR #24 (RFC-0002).
@gonzafg2
gonzafg2 marked this pull request as ready for review June 10, 2026 06:22
Copilot AI review requested due to automatic review settings June 10, 2026 06:22
@gonzafg2
gonzafg2 merged commit 113b149 into main Jun 10, 2026
6 checks passed
@gonzafg2
gonzafg2 deleted the adr/0016-phase-1-service-account-uid-model branch June 10, 2026 06:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds ADR-0016 documenting the Phase 1 operational UID model for command execution (run quantumsshd as a dedicated non-root service account) and records the new ADR in the changelog to keep the documentation set auditable and consistent with the Phase 1 threat-model posture described in RFC-0002.

Changes:

  • Add draft ADR-0016 describing the Phase 1 “run as service account” execution posture and its consequences/alternatives.
  • Update CHANGELOG.md with a new “Added” bullet for ADR-0016.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
docs/adr/0016-phase-1-service-account-uid-model.md New ADR documenting the Phase 1 service-account UID execution model and related operational constraints.
CHANGELOG.md Adds an “Unreleased / Added” entry referencing the new ADR and summarizing the decision.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +6
- **Status:** Proposed
- **Date:** TBD (advances to Accepted when Phase 1 implementation begins)
- **Deciders:** Project lead
- **Related:** Operational counterpart to [RFC-0002](../rfcs/0002-threat-model-phase1-uid-model-and-non-goal.md); this ADR depends on the merge of [PR #24](https://github.com/gonzafg2/quantumssh/pull/24) and should land after it.
Comment on lines +17 to +18
2. Run `quantumsshd` as `root` and drop to a service account after PID-1 initialisation.
3. Run `quantumsshd` as a dedicated non-root service account from PID 1.
Comment on lines +64 to +66
### Alternative 3: Run `quantumsshd` as a non-root service account from PID 1

**Chosen.** No privileged window, no `setuid` machinery, no PAM, no `passwd` resolution. The implementation surface is the smallest of the three options. The cost — Phase 1 cannot enforce per-user UID isolation — is exactly the non-goal that RFC-0002 §8.12 documents and accepts.
Comment thread CHANGELOG.md
Comment on lines +12 to +23
- `docs/adr/0016-phase-1-service-account-uid-model.md` (Proposed)
records the operational counterpart to RFC-0002: `quantumsshd` will
run in Phase 1 as a dedicated non-root service account
(`quantumssh:quantumssh`), never holding `root`, never calling
`setuid`/`setgid`/`initgroups`/`chroot`, and never integrating with
PAM. Commands inherit the service account's UID/GID and a sanitised
environment. The `executing_uid` audit field (RFC-0002 §2.7) is
populated by `nix::unistd::Uid::current()`; in Phase 1 the value is
a per-process constant, and the schema is forward-compatible with
the Phase 3 per-user value. The ADR depends on the merge of
RFC-0002 and advances from Proposed to Accepted when Phase 1
implementation begins.
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.

2 participants