Files
DodoSSH/src/DodoSSH.Contracts/SyncEntityType.cs
T
laurensandClaude Opus 5.5 ef365f462e Spelunk: sign each device in through the browser instead of keeping Spelunk API keys in the vault
A Spelunk API key reaches one organisation, so a server elsewhere - oc-linux in Orange Climate - was
refused before it reached the agent. Each device now signs in to a Spelunk once, under Settings ->
Security -> Spelunk or from a Spelunk host's editor: the OAuth authorization code flow with PKCE for a
native app (RFC 8252), with Spelunk as the authorization server. The browser opens Spelunk's
/api/app-sign-in/authorize with a loopback redirect (the app's own scheme on Android), the person signs
in there however they normally do and allows "DodoSSH on <device>", and the code is redeemed at
/api/app-sign-in/token for an app session token. That token opens terminals in every organisation its
person is in, with the role they have on each server at the time; tunnel tickets send no organisation.

The sign-in stays on the device: sealed in the local cache under the LocalCacheKey (AAD resource type
18, bound to its row), never synced, wiped with the cache, and only ever sent to the Spelunk it came
from. A 401 from Spelunk forgets it; SIGN OUT ends it there and here, and so does signing out of
DodoSSH. Before every Spelunk connection DodoSSH asks its own identity provider whether its sign-in
still stands (a forced refresh, at most once a minute), and an account it refuses is signed out of
DodoSSH and of every Spelunk on the device.

A route names no key any more: Spelunk hosts are written at host schema 11, which an older build shows
read-only and asks to be updated for, and a payload that still names a key credential decodes with the
id skipped. The SpelunkKey item type is gone: SyncEntityType 14, ChangeEntityType 14 and AAD type 17
are retired, the server drops spelunk_key and its change-log rows, and the client cache drops its
cached items, outbox entries and conflicts of that type. A link still never starts a sign-in: from a
Spelunk this device is not signed in to it opens the editor, which offers to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 16:26:25 +02:00

73 lines
2.5 KiB
C#

namespace DodoSSH.Contracts;
/// <summary>
/// The kind of vault item a sync change refers to.
/// </summary>
/// <remarks>
/// Values are persisted in the change log and are part of the wire contract. Append only;
/// never renumber. These mirror <c>CryptoSpec.AadResourceType</c> for the item types, but are
/// a separate enum because only syncable items appear here.
/// </remarks>
public enum SyncEntityType
{
/// <summary>Not a legal value.</summary>
Unspecified = 0,
/// <summary>An SSH host.</summary>
Host = 1,
/// <summary>A credential.</summary>
Credential = 2,
/// <summary>An SSH key pair.</summary>
SshKey = 3,
/// <summary>A host group.</summary>
HostGroup = 4,
/// <summary>A tag.</summary>
Tag = 5,
/// <summary>A host-to-tag association.</summary>
HostTag = 6,
/// <summary>A host-to-credential association.</summary>
HostCredential = 7,
/// <summary>A command snippet.</summary>
Snippet = 8,
/// <summary>A port forward.</summary>
PortForward = 9,
/// <summary>A known SSH host key.</summary>
KnownHostKey = 10,
/// <summary>One connection that was made, and how long it lasted.</summary>
/// <remarks>
/// The first member added here since the contract was frozen; every one before it was reserved in
/// advance. Logs are synced items rather than local files because they are audit records — an
/// administrator has to be able to read a shared vault's history once teams land, and a log kept only on
/// the machine that produced it can be neither read nor trusted by anybody else. See ADR 0001 for what
/// that costs in metadata.
/// </remarks>
ConnectionLogEntry = 11,
/// <summary>One create, edit or delete of a vault item.</summary>
/// <inheritdoc cref="ConnectionLogEntry" path="/remarks" />
ActivityLogEntry = 12,
/// <summary>
/// An S3-compatible bucket, and the credentials that reach it.
/// </summary>
/// <remarks>
/// Named for the protocol's shape rather than for Amazon, because what it addresses is any service
/// speaking S3 — MinIO, R2, Backblaze, Ceph — and a member called <c>S3</c> would read as a claim about
/// the vendor. The interface says S3, which is what people call the protocol.
/// </remarks>
ObjectStore = 13,
// 14 was SpelunkKey, a Spelunk API key and its address, removed while still in beta when signing in to
// Spelunk replaced it. Not to be reused: an old client may still send it, and must be refused as unknown.
}