Repository navigation
Open
Labels
Description
Problem
In a shared workspace, Git uses the workspace owner's identity and credentials for every user who connects, including users with only the use role.
#31152 documents this behavior and the manual workarounds.
- Commit identity: templates commonly set
GIT_AUTHOR_*andGIT_COMMITTER_*fromdata.coder_workspace_owner.meat build time. - Git over SSH:
coder gitsshfetches the owner's key (GetGitSSHKey(ctx, workspace.OwnerID)incoderd/gitsshkey.go). - Git over HTTPS:
workspaceAgentsExternalAuthincoderd/workspaceagents.golooks up the external auth link byworkspace.OwnerID.
To work as themselves, shared users must export GIT_AUTHOR_* in every shell, forward their SSH agent, or sign in to a tool such as the GitHub CLI.
Every one of these overrides is visible to the other users of the workspace.
Proposal
Suggested by @matifali in #31152 (comment).
Coder knows which user connects to a shared workspace, so it could set the commit identity for that user's session automatically.
It could also resolve external auth tokens for the connecting user instead of the owner.
Constraints to investigate
- The agent doesn't know who is connected over SSH.
ReportConnectionincoderd/agentapi/connectionlog.goleavesUserIDunset with the comment "It's not possible to tell which user connected."
feat: log tailnet tunnels to the connection log #27423 records the user in coderd when the tailnet tunnel opens, but it doesn't pass that identity to the agent or to the SSH session. - Template env vars override per-session env.
InupdateCommandEnvinagent/agent.go,coder_agentenv vars from the manifest override the session environment, socoder ssh -e GIT_AUTHOR_NAME=...has no effect when the template setsGIT_AUTHOR_*.
A per-user identity must take precedence over template values, or templates must stop setting these variables. - External auth is requested with the shared agent token.
coder gitaskpassandcoder external-auth access-tokencall the agent API with the workspace's agent token, so coderd can't tell which user is asking. - All users share one OS user and home directory.
A token injected into one user's session is readable by other users through the process environment, Git credential caches, or files in$HOME.
Per-user external auth needs an isolation design, not only plumbing. - Some processes aren't tied to one connection.
Long-running processes, such as code-server started once for the workspace, have no single connecting user.
Generated by Coder Agents on behalf of @nickvigilante.
Reacted by Atif Ali
Activity
linear-code commentedon Nov 3, 2026
ENG-3504