Skip to content

.dclaude config from cloned repos is trusted without confirmation #72

Description

@alanbem

Problem

find_config_file() walks up from $PWD and honors any .dclaude file found — including one committed to a repo the user just cloned. A malicious or compromised repo can set:

  • GIT_AUTH=key-mount → mounts the user's ~/.ssh (private keys) into the container
  • MOUNT_ROOT=.. (or deeper) → widens the writable bind mount above the repo, resolved relative to the config file's directory
  • CA_CERT=... → injects a CA into the container's Node/TLS trust
  • NAMESPACE=... → redirects which credential volume gets used/populated

Combined with CLAUDE_UNSAFE_TRUST_WORKSPACE=true (set in the Dockerfile, intentionally, on the premise that container isolation is the safety boundary), a repo-committed file can silently widen that exact boundary. git clone evil/repo && cd repo && dclaude is the whole attack.

Fix

direnv-style first-use approval: hash the .dclaude content; on first sight (or content change) show the parsed settings and require confirmation, recording approval in ~/.dclaude/approved-configs. Env vars set by the user keep working without prompts.

A cheaper interim step: only honor the security-sensitive keys (GIT_AUTH, MOUNT_ROOT, CA_CERT, NAMESPACE) from env vars, never from the file — or print a prominent warning showing which values came from a config file inside the repo.


Found during a full-project code review.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitySecurity-relevant issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions