Repository navigation
Description
Summary
The embedded auth server's Redis-backed storage cannot connect to a Redis/Valkey instance that has no authentication configured. convertRedisACLConfig (pkg/authserver/runner/embeddedauthserver.go) treats a nil ACLUserConfig as a hard error ("acl user config is required"), and even with a config present the password is mandatory. So the only way to run the embedded auth server against Redis today is with a password.
That blocks legitimate deployments where the store runs without auth on purpose: local/dev clusters, single-tenant deployments where network isolation is the boundary, and managed tiers that are provisioned without ACL users. The username is already optional (an empty UsernameEnvVar falls back to the default user / legacy AUTH), so no-auth is the natural next step; only the mandatory password stands in the way.
The goal is to make no auth a selectable mode for the toolhive-owned Redis consumers, while keeping a misconfigured credential a loud failure rather than a silent downgrade.
Why the distinction matters
An unset credential and a misconfigured one look different and must be treated differently.
- Nil
ACLUserConfigmeans no credential was intended. That should resolve to a no-auth connection. - A populated
ACLUserConfigwhosePasswordEnvVarresolves to empty means something is wrong: a mis-keyed secret, a wrong-namespace secret, or an unsynced external-secrets store. Silently booting unauthenticated in that case would be a downgrade, not a choice, and the store holds sensitive rows (OAuth clients, DCR registrations, session data). That path must keep erroring.
So the split is on presence of the config block, not on whether the resolved password happens to be empty.
Proposed behaviour
convertRedisACLConfig: whenACLUserConfigis nil, return empty username and password with no error (a no-auth config), instead of the current"acl user config is required".createStorage/convertRedisRunConfigno longer require an ACL config for theredisstorage type.- Populated-but-empty still errors: when
ACLUserConfigis present butPasswordEnvVarresolves to empty, keep returning an error. Do not downgrade to unauthenticated on a config that was clearly meant to carry a credential. - A configured password is carried through unchanged: the existing authenticated path (populated block, password resolves) is unaffected.
- One startup
WARNon a no-auth resolution: when a toolhive-owned Redis consumer resolves to no authentication, emit exactly one startupWARNnaming the store it is connecting to (address / key prefix), so an unintended downgrade is visible in logs rather than silent. This applies to both:- the embedded auth server's Redis storage (
createStorage/convertRedisRunConfig), and - the vMCP Redis session storage (
buildSessionDataStorageinpkg/vmcp/server/server.go), which already tolerates an emptyTHV_SESSION_REDIS_PASSWORDbut currently logs unconditionally atINFOwithout distinguishing whether auth is present. It should log aWARNwhen it resolves to no auth.
- the embedded auth server's Redis storage (
Out of scope
- No change to the authenticated default: a populated
ACLUserConfigstill requires its password to resolve. - Username stays optional exactly as today (
default-user / legacyAUTHfallback). - TLS handling, timeouts, and Sentinel/cluster topology are unchanged.
- Dynamic / IAM-minted credentials are a separate concern, not part of this change.
Notes for the implementer
RedisRunConfig.AuthTypeis documented asmust be "aclUser"but the conversion code does not branch on it. Its doc comment (andconvertRedisACLConfig's) should be updated to state that a nilACLUserConfigis now a valid no-auth configuration rather than an error.- The no-auth
WARNshould fire exactly once at startup per consumer, and name the store, so the message is actionable when the no-auth resolution was unintended.
Suggested tests
- A nil
ACLUserConfigyields empty username/password with no error, and a client built from the resulting config connects to a no-auth server. - A populated
ACLUserConfigwhosePasswordEnvVarresolves to empty still returns an error. - A populated
ACLUserConfigwith a resolvable password carries it through unchanged. - A no-auth resolution emits exactly one startup
WARNnaming the store, for both the embedded auth server storage and the vMCP session storage.
Activity
Support no-auth Redis for the embedded auth server and vMCP sessions (#…