Package map subpath resolves outside the target package directory
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 70/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js
调研方向
首先使用 app/index.js 和 node --experimental-package-map 运行 package-map.json 重现。跟踪包含 ../../secret.js 时 dep 子路径的解析方式,并验证解析会使用 ERR_INVALID_MODULE_SPECIFIER 拒绝 dep 之外的任何路径。
由索引模型根据 Issue 内容生成。
描述
Version
v26.5.0
Platform
Subsystem
module
What steps will reproduce the bug?
// package-map.json
{
"packages": {
"app": { "url": "./app", "dependencies": { "dep": "dep" } },
"dep": { "url": "./dep", "dependencies": {} }
}
}
// app/index.js
require('dep/../../secret.js');
node --experimental-package-map ./package-map.json app/index.js
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
Resolution should fail with ERR_INVALID_MODULE_SPECIFIER, because the subpath escapes the target package's own directory (dep) as declared in the package map.
What do you see instead?
The specifier resolves successfully to a file outside the target package directory.
Additional information
No response
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 279
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nodejs/node 的其他 Issue
-
doc
难度 2/5 1-3 小时 新手友好度 65/100
-
build
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 1/5 1 小时以内 新手友好度 90/100
-
feature request
难度 2/5 1-3 小时 新手友好度 68/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
palladius/rails8-app-on-gcp#145 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
dotenvx/dotenv-vscode#139 ·
-
test-change-proposal
难度 2/5 1-3 小时 新手友好度 65/100
web-platform-tests/interop#1455 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
corsairdev/corsair#1764 ·
-
难度 2/5 1-3 小时 新手友好度 75/100