Feature option values are changed before install.sh sees them: quotes are stripped, and `$…` is expanded or executed
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- shell, typescript
调研方向
Start in getFeatureEnvVariables in src/spec-node/containerFeatures.ts, which writes each option as NAME="value" without escaping, and compare it with escapeQuotesForShell, which the issue says already handles the wrapper's Options echo. Reproduce with the local ./echo-opt Feature from the issue, where the value contains quotes, $HOME and $(id -un). Done means the printed value matches the configured string exactly, values with spaces still work, and the behaviour change for $ expansion is either accepted or handled, which needs a maintainer decision first.
由索引模型根据 Issue 内容生成。
描述
Problem
A Feature can receive a different string option value from the one configured in
devcontainer.json. Quotes are removed, $VAR is expanded, $(…) and backticks are executed, and backslashes are consumed. The build still succeeds, so nothing
signals that the value changed.
Repro (devcontainer CLI 0.89.0)
A local Feature with one string option, value, whose install.sh prints it:
#!/bin/sh
printf '%s\n' "$VALUE"
"features": { "./echo-opt": { "value": "say \"hi\" to $HOME as $(id -un)" } }
- Expected:
say "hi" to $HOME as $(id -un) - Actual:
say hi to /root as root
A value with a space inside quotes, such as A="two words", fails the build instead,
with devcontainer-features.env: line 1: words: not found.
Cause
getFeatureEnvVariables (src/spec-node/containerFeatures.ts) writes each option as
NAME="value" without escaping. The install wrapper then sources the file
(set -a; . ./devcontainer-features.env), so the shell interprets the value. Issue #148
and PR #149 fixed this for spaces, but not for ", $, backticks or \.
Suggested fix
Write each value in single quotes, with ' escaped as '\''. That's what
escapeQuotesForShell already does for the wrapper's Options echo. This changes
behaviour for anyone relying on $ being expanded in option values today.
- 主要语言
- TypeScript
- 星标
- 3k
- 派生
- 462
- 平均合并
- 13 小时 28 分钟
- 30 天内合并 PR
- 2
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
devcontainers/cli 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
devcontainers/cli#1325 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
devcontainers/cli#1203 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 68/100
devcontainers/cli#1178 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
devcontainers/cli#1327 ·
维护者通常 1 天内回复
-
`devcontainer build` fails on Buildx 0.37.2 because the generated Dockerfile is outside the Compose bake context可能已有人在做 @v-Kaniska244 于 6 天前认领。 未关闭
devcontainers/cli#1320 · 1 条评论 · 4 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
查看 devcontainers/cli 的全部 Issue
相似的 Issue
-
A hung CI job runs for 6 hours before it is cancelled可能已有人在做 @Olanetsoft 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
Olanetsoft/agent-lookout#110 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
thedotmack/claude-mem#4757 ·
维护者通常 1 天内回复
-
🐛 bug 🗺️ MCP OAuth
难度 2/5 1-3 小时 新手友好度 62/100
LibreChat-AI/LibreChat#17077 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100