Skip to content

feat(clientauth): headless Linux credential storage - #1291

Merged
jhrozek merged 10 commits into
mainfrom
impl/headless-client-credential-storage
Sep 9, 2026
Merged

jhrozek merged 10 commits into
mainfrom
impl/headless-client-credential-storage

Conversation

@jhrozek

@jhrozek jhrozek commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds file-backed credential storage for headless Linux mecatui login, per the
approved acceptance plan. A new owner-only plaintext CAS backend
(credentialstore.PlainFileStore) sits alongside the existing keyring-backed
store; internal/adapter/clientauth gains ResolveCredentialStore,
OpenCredentialStore, and OpenExistingCredentialStore to pin one backend per
canonical credential-store root before OAuth starts, and every later login,
connect, refresh, reauthentication, and logout goes through that pin (no
fallback, switch, or migration). On Linux, auto performs a private,
deadline-bounded Secret Service detection (never a mutating probe) to decide
between keyring and file; macOS keeps the current keyring-default auto.
mecatui login gains --credential-store=auto|keyring|file.

  • feat(credentialstore): owner-only plaintext CAS backend (0700/0600, CAS + ABA resistance).
  • feat(clientauth): backend pinning, stored-login lifecycle wiring, Linux Secret Service detector.
  • test(clientauth): detector-stage and backend-lifecycle boundary tests, production-route and qualification-wiring tests.
  • fix(credentialcheck): resolve the credential-store fixture boundary from an absolute cwd.
  • test(clientauth): remove the standalone Kind credential checker in favor of the real CLI for manual qualification.

Development stage

  • Implementation — based on an approved, merged Plan / Interface PR

Contract linkage

  • Acceptance plan: docs/acceptance/headless-client-credential-storage.md
  • Human decisions resolved and recorded: Yes
  • Plan / Interface PR: docs: plan headless mecatui credential storage #1281
  • Approved commit baseline: 130db7a (docs: record credential storage plan approval)
  • Combined/exemption rationale: N/A (Implementation PR)

Interface conformance

Matches approved contract: CredentialStoreMode/CredentialBackend/CredentialStoreSelection,
ResolveCredentialStore/OpenCredentialStore/OpenExistingCredentialStore,
NewPlainFile/OpenExistingPlainFile, the private detectLinuxSecretService helper
protocol, mecatui login --credential-store, and the clientauth-credential-backend.json /
clientauth-plaintext/ on-disk layout, all as specified in the plan's Interface contract
section.

Scenario 5's manual Kind/Keycloak live qualification (macOS explicit-file and
Linux headless-auto journeys — login, authenticated connect, natural
token-refresh window, new-process connect, logout, failed post-logout connect)
has been run and passed against the deploy/mecak8s-kind fixture, and is
recorded in the plan's AC5.2 evidence note. Remaining before the plan can be
marked landed is the full baseline-checks list in Definition of done item 4
(task lint, task test, task api:check, task docs, task site:build,
go run ./cmd/mecademo).

Issue relationship

Relates to #1271

Type of change

  • New feature
  • Bug fix

Test plan

Baseline checks

  • Acceptance-plan checker
  • Linting (task lint) — deferred to CI
  • Offline test suite (task test)
  • Offline demo (go run ./cmd/mecademo) — unaffected by this change
  • Markdown changed: docs generation/link checks (task docs)
  • User docs/user-facing behavior changed: site build (task site:build)
  • Guarded engine API affected: compatibility check (task api:check) — engine/ untouched
  • Intentional engine API change: task api:update + engine/CHANGELOG.md
  • Landed plan: strict acceptance trace (task ac-trace-strict) — plan not yet fully landed
  • Final implementation review: /panel-review

User-facing change

mecatui login accepts a new --credential-store=auto|keyring|file flag
(default auto). On headless Linux without a running desktop Secret Service,
login now falls back to an owner-only plaintext credential file instead of
failing with authentication unavailable: storage_unavailable, printing a
one-time notice. macOS behavior is unchanged.

Special notes for reviewers

  • Manual live qualification against the deploy/mecak8s-kind Keycloak/TLS
    fixture (macOS explicit-file + Linux headless-auto journeys) has passed —
    see the plan's Scenario 5 AC5.2 evidence note for the recorded result.
  • The Linux detector uses a private same-executable helper invoked via
    exec.CommandContext with reserved exit codes (80/81/82); it is not a
    supported user-facing command.

jhrozek and others added 10 commits September 9, 2026 22:27
Add the fixture checker and manual qualification guide. Keep the acceptance plan in-progress: Linux detector qualification, complete aggregate gates, and live platform journeys remain outstanding.

Co-Authored-By: mecatl <[email protected]>
…aries

Exercise real private D-Bus wire fixtures and cross-process credential rotation. Add Linux discovery/dial isolation fixtures and unsupported-platform tests; these platform binaries are compile-checked here, not executed. Keep manual qualification pending.

Co-Authored-By: mecatl <[email protected]>
…on wiring

Exercise real opener boundaries, durable selection before OAuth, connect refresh, existing-only reauth, and logout. Assert actual Taskfile wiring and joined SIGKILL; inventory persistent plaintext selection resources.

Co-Authored-By: mecatl <[email protected]>
Correct the credential-store resource inventory symbol citation.

Co-Authored-By: mecatl <[email protected]>
Use the real CLI for manual qualification and retain detailed persistence assertions in hermetic tests, as approved.

Co-Authored-By: mecatl <[email protected]>
Scenario 5's manual macOS explicit-file and Linux headless-auto journeys
against the deploy/mecak8s-kind fixture completed successfully.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Non-production, test-only diagnostic to capture why
TestHeadlessCredentialStorage_Scenario1_LinuxDiscoveryBudget fails on the
GH-hosted ubuntu-24.04 runner but not in local repro. Writes uid/gid,
/run/user/0 listing, and the raw dbus dial error to a debug.log inside the
fixture root, logged on assertion failure. To be reverted once the CI
failure is understood.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The GH-hosted ubuntu-24.04 runner permits creating the unprivileged
user+mount namespace (the existing outer probe passes) but its LSM/kernel
policy still denies chroot(2) inside it with EPERM, which the child
previously treated as a generic detection failure (exit 82) and made the
test fail hard instead of recognising the fixture itself as unsupported
here - the same class of case the outer probe already skips for a denied
clone(2).

The child now exits a distinct sentinel (83) specifically for an
EPERM/EINVAL chroot, and the test skips on that sentinel instead of
failing, mirroring the existing outer-probe skip.

Diagnosed via a temporary debug.log dump from the sandboxed child on CI
(reverted here) that showed:
  chroot("/tmp/...")=operation not permitted chdir(/)=<nil>

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jhrozek
jhrozek force-pushed the impl/headless-client-credential-storage branch from c2714e7 to 6b16150 Compare September 9, 2026 20:28
@jhrozek
jhrozek merged commit 5b46ed9 into main Sep 9, 2026
31 checks passed
@jhrozek
jhrozek deleted the impl/headless-client-credential-storage branch September 9, 2026 20:52
@jbeda

jbeda commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Woohoo! Thank you!

jbeda added a commit that referenced this pull request Sep 11, 2026
* commit 'cc6b16afbf7feec3e16451fdc590a3265fbf0c0b':
  docs: amend Shell diagnostic ownership (#1330)
  fix(mecatui): refresh status context on session continuation (#1328)
  fix(jsonlstore): preserve session saves with legacy lineage (#1327)
  test(sessiondebug): eliminate handle tampering flake (#1323)
  fix(agent): authorize structured subagent results (#1317)
  feat(mcp): support attachment-backed broker queries for CallMcpWithQuery (#1309)
  docs(agents): document full-gate timeout guidance (#1316)
  fix(server): let the stale-session sweep re-acquire a lost lease (#1302)
  feat(clientauth): headless Linux credential storage (#1291)
  chore(mcpbroker): trace protected call latency (#1314)

# Conflicts:
#	docs/acceptance/canonical-shell-command-tool.md
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