[BUG] `npm config get` rejects paths with UUID directory names
Maintainer thường phản hồi trong vòng 2 ngày
@PCTEJA đang làm issue này rồi.
Từ ngày 24/11/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, nodejs
- Lĩnh vực
- cli
Hướng nghiên cứu
Run the reproduction script in a fresh shell to see the differing config get, config list, and config list --json outputs. Then read lib/commands/config.js, focusing on get(), listJson(), displayVar(), and the isPrivate() call, alongside the privacy tests in test/lib/commands/config.js. Trace the UUID matcher in the bundled @npmcli/redact; done means both list modes retain UUID-shaped paths and the protected-key and proxy-redaction tests still pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
This is not just a request to bump a dependency for a CVE
- This is not solely a request to bump a dependency for a CVE
Current Behavior
npm config get userconfig refuses an existing npmrc path when a parent directory name has the shape of a UUID. This prevents callers from discovering the configured file location. The same behavior affects other filesystem path settings.
The plain path is printed with exit status 0. For the UUID path, stdout is empty, the exit status is 1, and stderr contains:
npm error The userconfig option is protected, and cannot be retrieved in this way
With analogous UUID and plain paths, config get globalconfig, config get prefix and config get cache show the same distinction. For the UUID case, config list prints userconfig = "$W/***/.npmrc" and config list --json omits userconfig.
Expected Behavior
Each npm config get userconfig call writes its configured path to stdout and exits 0. Both forms of npm config list show that setting with its usable path. The empty npmrc files differ only in their parent directory names.
Steps To Reproduce
Run these commands in a fresh shell with the latest published npm on PATH. The commands create empty configuration files in a temporary directory and change only the environment of that shell.
W=$(mktemp -d "${TMPDIR:-/tmp}/npm-path-repro.XXXXXX")
W=$(cd "$W" && pwd -P)
cd "$W" || exit
uuid=550e8400-e29b-41d4-a716-446655440000
mkdir -p "$W/plain" "$W/$uuid"
touch "$W/plain/.npmrc" "$W/$uuid/.npmrc" "$W/global.npmrc"
export NPM_CONFIG_GLOBALCONFIG="$W/global.npmrc"
export NPM_CONFIG_CACHE="$W/cache"
export NPM_CONFIG_USERCONFIG="$W/plain/.npmrc"
npm config get userconfig
printf 'exit=%s\n' "$?"
export NPM_CONFIG_USERCONFIG="$W/$uuid/.npmrc"
npm config get userconfig
printf 'exit=%s\n' "$?"
npm config list
npm config list --json
Environment
- macOS arm64, Node.js v26.13.1, isolated empty npmrc files.
- Reproduced with the latest published npm (12.2.3), its preceding patch (12.2.2), the latest releases on the 11.x and 10.x lines (11.21.3 and 10.9.11), and a fresh clone of
latestat787f1520fa412e91a5792468f1c7f25b166867a6. - Release boundary reproduced on the 10.x line. The UUID path was returned in 10.7.0 and refused in 10.8.0.
Evidence
- Expected source: npm config documentation, Get and List documents returning configuration values. The userconfig definition documents a path and explicitly supports an environment override.
- Failure source: The local CLI reproduction above used the published package or cloned entry point. In
lib/commands/config.js,get()andlistJson()callisPrivate(). It classifies any value changed by@npmcli/redactas private. The bundled package's UUID matcher also matches the synthetic directory component in this example. Text listing redacts the same component indisplayVar(). - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
Restoration check
With either directory name, npm config get userconfig exits 0 and returns the resolved path, and the text and JSON listings retain that path. The other named settings should also return their paths through config get. The protected-key and proxy-redaction tests in test/lib/commands/config.js should keep passing.
References
- https://github.com/npm/cli/issues/3867 — reports disclosure of actual proxy credentials, the case that led to the config output change.
- https://github.com/npm/cli/pull/7521 — introduced this config privacy decision to protect credentials and established what each output mode should do with a protected value.
Triage assessment
- Impact level: P2
- Assessment status: supported
- Impact basis: Scripts and users lose access to these config values whenever their resolved paths include a UUID-shaped segment. The config files and paths remain in place.
- Workaround status: unverified
- Workaround basis: A directory without a UUID produces readable output. Changing the path can be impractical when the caller is trying to discover an existing setting.
- Ngôn ngữ chính
- JavaScript
- Star
- 10.3k
- Fork
- 5k
- Merge trung bình
- 4 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của npm/cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endingsCó thể đã có người làm @saruk-vedant đã nhận 7 ngày trước. Đang mởBug Needs Triage Triage Requested
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] npm pkg delete removes the first array item for a nonexistent propertyCó thể đã có người làm @drawliin đã nhận 42 ngày trước. Đang mởcmd:delete Priority 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 2 ngày
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings loggedCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởEngineering Priority 1
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 2 ngày
-
`npm audit signatures` does not report how many packages it skipped for want of registry keysCó thể đã có người làm @greenlincoln05 đã nhận 63 ngày trước. Đang mởPriority 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
docs: add SECURITY.md vulnerability reporting policyCó thể đã có người làm @AK-Lmn đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
flisk-sh/linux2wasm#12 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
possible bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Mintplex-Labs/anything-llm#7388 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 60/100
Maintainer thường phản hồi trong vòng 1 ngày
-
v6: Minified bootstrap.min.css is missing header infoCó thể đã có người làm @lazerg đã nhận hôm nay. Đang mởbug build confirmed has-pr v6
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[workshop-sync] workshop/side-quest-26-01-forecast-costs.md: forecast default history window is inaccurateCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
githubnext/gh-aw-workshop#6332 ·
Maintainer thường phản hồi trong vòng 1 ngày