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

Use octal file modes in the Redis and Valkey modules

Đang mở Phù hợp với người mới
#1,526 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
79/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ệ
docker, node.js, typescript
Lĩnh vực
databases, testing

Hướng nghiên cứu

Đọc packages/modules/redis/src/redis-container.ts và packages/modules/valkey/src/valkey-container.ts, tập trung vào các giá trị mode của withCopyFilesToContainer. Kiểm tra cách FileToCopy.mode được ghi tài liệu hoặc sử dụng, sau đó chạy các bài kiểm thử liên quan của hai module Redis và Valkey. Công việc hoàn tất khi tệp dữ liệu dùng 0o644 và tập lệnh import dùng 0o755 trong cả hai module.

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

Mô tả

bug patch

What happens

The Redis and Valkey modules pass file modes as decimal numbers where octal was intended:

this.withCopyFilesToContainer([
  { mode: 666, source: this.initialImportScriptFile, target: this.importFilePath },
  { mode: 777, source: path.join(__dirname, "import.sh"), target: "/tmp/import.sh" },
]);

Decimal 666 is octal 1232 and decimal 777 is octal 1411. Copying files with those modes and running stat in the container:

/tmp/mode-decimal-666  1232  --w--wx-wT
/tmp/mode-decimal-777  1411  -r----x--t
/tmp/mode-octal-666     666  -rw-rw-rw-
/tmp/mode-octal-777     777  -rwxrwxrwx

So the import data file is write-only for its owner, and import.sh is read-only for its owner and execute-only for everyone else. withInitialData works today only because exec runs as root (uid 0), which bypasses the permission bits. A non-root exec user could read neither file.

Expected

The modes are written in octal (0o644 for the data file, 0o755 for the script).

Where

  • packages/modules/redis/src/redis-container.ts
  • packages/modules/valkey/src/valkey-container.ts

Notes

  • FileToCopy.mode and ContentToCopy.mode are typed number with no JSDoc. A one-line comment saying the value is an octal permission (0o644) would help prevent this.
  • The stat output was reproduced on main (aa60a746, 12.2.0) with GenericContainer and the same mode values. The non-root case is from reading the permission bits, not run.

Dependencies

  • Nothing blocks this. It can start now.
  • Coordinate with #1525: the exec call in the same two files sits a few lines below the modes. Change both in one pull request.
Ngôn ngữ chính
TypeScript
Star
2.6k
Fork
274
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
44

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 testcontainers/testcontainers-node

Tất cả issue của testcontainers/testcontainers-node

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.