Skip to content

[Bug] .npmrc tmpfs mount creates empty directory instead of hiding file #763

@Mossaka

Description

@Mossaka

Summary

PR #738 replaced individual /dev/null file mounts with directory-level tmpfs overlays for credential hiding. However, ~/.npmrc is a file, not a directory. Mounting tmpfs over a file path creates an empty directory at that path, which can confuse tools that check for .npmrc existence.

Problem

In src/docker-manager.ts, the credential hiding logic creates tmpfs mounts for these paths:

~/.docker, ~/.ssh, ~/.aws, ~/.kube, ~/.azure, 
~/.config/gcloud, ~/.config/gh, ~/.cargo, ~/.composer, ~/.npmrc

All of these except ~/.npmrc are directories. For directories, tmpfs works correctly - it creates an empty in-memory filesystem that shadows the real directory contents.

For ~/.npmrc (a file), Docker creates an empty directory named .npmrc instead. This means:

  • test -f ~/.npmrc returns false (it's a directory now, not a file)
  • test -d ~/.npmrc returns true (unexpected)
  • npm config list may behave differently with a directory vs. no file
  • Tools that check if [ -e ~/.npmrc ] will see "something exists" but reading it will fail differently than expected

Expected Behavior

~/.npmrc should either:

  1. Not exist at all (as if the file was deleted), OR
  2. Exist as an empty file (as the old /dev/null mount provided)

Actual Behavior

~/.npmrc becomes an empty directory, which is neither of the expected states.

Proposed Fix

Options:

  1. Keep ~/.npmrc as a /dev/null bind mount (revert to the pre-fix: replace /dev/null mounts with tmpfs for credential hiding #738 approach for this single file)
  2. Mount tmpfs on the parent directory if .npmrc is the only sensitive file there
  3. Use an empty file bind mount instead of tmpfs for file paths

Added By

PR #738 (fix: replace /dev/null mounts with tmpfs for credential hiding). The Copilot PR reviewer flagged this concern but it was suppressed due to low confidence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions