Skip to content

Unify git credentials under drive credential + remote per-principal management#102

Merged
gmpassos merged 1 commit into
masterfrom
feat/drive-credential-remote
Jul 2, 2026
Merged

Unify git credentials under drive credential + remote per-principal management#102
gmpassos merged 1 commit into
masterfrom
feat/drive-credential-remote

Conversation

@gmpassos

@gmpassos gmpassos commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the node-host-local omnyshell node git-credential (shipped in v1.50.0) with a single omnyshell drive credential {add,list,remove} group, and adds remote management of a client's own git credentials on a node over the hub.

Mode is chosen explicitly:

  • --local — manage credentials on this node host (~/.omnyshell/git-credentials.json), with --global (default) or --for-principal <p>; supports --ssh-key/--passphrase.
  • --node <node> — manage your own credentials on a remote node, over the hub (HTTPS only: --pat, --username/--password), using the shared connect flags.
omnyshell drive credential add github.com --pat <t> --node web-01     # remote (you)
omnyshell drive credential list --node web-01
omnyshell drive credential add github.com --pat <t> --local           # node-host admin
omnyshell drive credential add github.com --ssh-key ~/.ssh/id --local

Security model

Remote management is a hub-brokered control-RPC (DriveCredentialRequest → hub → NodeDriveCredentialRequest → response), mirroring the existing sessions screen/kill RPCs. The hub stamps the authenticated principal (peer.principal), so a client can only ever read/modify its own credentials on the node — never the global scope or another principal's. The hub authorizes it exactly like opening a drive (canOpenSession(mode: drive)); the node additionally requires driveEnabled and only ever mutates scopeFor(principal: <stamped>). Concurrent RPCs are serialized node-side to avoid load/save races.

NodeConfig gains an optional gitCredentialsHome (used by both the drive-open resolver load and the RPC handler) so a node's store is relocatable — enabling per-node test isolation.

Changes

  • Protocol: new DriveCredentialRequest/NodeDriveCredentialRequest/NodeDriveCredentialResponse/DriveCredentialResponse + DriveCredentialEntry (control_message.dart), registered in frame_codec.
  • Hub: _handleDriveCredentialRequest (authorize + stamp principal + relay); response → _completeNodeRpc.
  • Node: _onDriveCredentialRequest (serialized; scopes to req.principal; driveEnabled gate); NodeConfig.gitCredentialsHome.
  • Client: driveCredentialAdd/List/Remove + DriveCredentialResult.
  • CLI: removed node git-credential; added drive credential (local + remote).

Test plan

  • dart analyze + dart format --set-exit-if-changed . — clean.
  • Unit: codec round-trip for the new message quartet.
  • Integration (TestCluster): remote add/list/remove scoped per principal — alice's entry stored under alice (never global, never bob); bob's list sees nothing of alice's; remove affects only the caller.
  • Full suite green (662 unit + integration incl. existing drive + authenticated-HTTP git clone). Bumps to 1.51.0.

Requires omnydrive ^1.10.0 (no omnydrive change).

🤖 Generated with Claude Code

….51.0)

Replace the node-host-local `omnyshell node git-credential` with a single
`omnyshell drive credential {add,list,remove}` group, mode chosen explicitly:

- `--local`  — manage credentials on this node host (~/.omnyshell/git-credentials.json),
  with --global (default) or --for-principal <p>; supports --ssh-key.
- `--node <node>` — manage YOUR OWN credentials on a remote node over the hub
  (HTTPS only). Scoped to the calling principal.

Transport is a hub-brokered control-RPC (DriveCredentialRequest → hub →
NodeDriveCredentialRequest → response), mirroring the sessions screen/kill RPCs.
The hub stamps the authenticated principal, so a client can only ever read or
modify its own credentials on the node — never the global scope or another
principal's. The hub authorizes it exactly like opening a drive session
(canOpenSession, mode: drive); the node additionally requires driveEnabled and
only ever mutates scopeFor(principal: <stamped principal>). Concurrent RPCs are
serialized on the node to avoid load/save races.

NodeConfig gains an optional gitCredentialsHome (used for both the drive-open
resolver load and the RPC handler) so a node's store is relocatable — enabling
per-node test isolation.

Tests: codec round-trip for the new message quartet; end-to-end TestCluster
integration proving per-principal scoping (add/list/remove; one principal never
sees another's; stored under the caller, never global). Bumps to 1.51.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gmpassos gmpassos merged commit 92219cf into master Jul 2, 2026
5 checks passed
@gmpassos gmpassos deleted the feat/drive-credential-remote branch July 2, 2026 01:53
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.

1 participant