Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions assistant/src/daemon/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { randomBytes } from 'node:crypto';
import { existsSync, chmodSync, writeFileSync, unlinkSync, readdirSync, watch, type FSWatcher } from 'node:fs';
import { join } from 'node:path';
import { getSocketPath, getSessionTokenPath, getRootDir, getWorkspaceDir, getWorkspaceSkillsDir, getSandboxWorkingDir, removeSocketFile } from '../util/platform.js';
import { hasSocketOverride } from './connection-policy.js';
import { getLogger } from '../util/logger.js';
import { getFailoverProvider, initializeProviders } from '../providers/registry.js';
import { RateLimitProvider } from '../providers/ratelimit.js';
Expand Down Expand Up @@ -481,6 +482,20 @@ export class DaemonServer {
this.connectedSockets.add(socket);
const parser = createMessageParser({ maxLineSize: MAX_LINE_SIZE });

// When the daemon is listening on a custom/forwarded socket
// (VELLUM_DAEMON_SOCKET), clients may not have access to the local
// session token file (e.g. SSH-forwarded connections). Auto-authenticate
// these connections so they aren't disconnected by the auth timeout.
// Clients that DO have a token will still send an auth message which
// is accepted normally via the auth gate below.
if (hasSocketOverride()) {
Comment thread
siddseethepalli marked this conversation as resolved.
this.authenticatedSockets.add(socket);
log.info('Auto-authenticated client on overridden socket path');
this.sendInitialSession(socket).catch((err) => {
log.error({ err }, 'Failed to send initial session info after auto-auth');
Comment thread
siddseethepalli marked this conversation as resolved.
});
}
Comment thread
siddseethepalli marked this conversation as resolved.

// Require authentication before sending session info or accepting
// commands. Clients must send { type: 'auth', token } as their
// first message within AUTH_TIMEOUT_MS.
Expand Down
Loading