Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Feature option values are changed before install.sh sees them: quotes are stripped, and `$…` is expanded or executed

Đang mở
#1,324 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
shell, typescript
Lĩnh vực
cli, developer-experience

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
3k
Fork
462
Merge trung bình
13 giờ 28 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của devcontainers/cli

Tất cả issue của devcontainers/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.