Redact live-streamed subprocess output in System.run()
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 72/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ệ
- typescript
Hướng nghiên cứu
Bắt đầu với src/model/system/system.ts để lần theo đường dẫn ghi stdout/stderr trực tiếp, sau đó đọc src/model/secret-redaction.ts và chuỗi thảo luận review về hành vi redaction hiện có. Kiểm thử một secret bị chia thành hai stream chunk và xác minh rằng đầu ra được truyền được redacted trong khi runResult.output không thay đổi; đồng thời bao phủ cả đường dẫn không có secrets.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
game-ci/cli#246 added the first secret redaction in src/. Before it, nothing anywhere redacted anything.
That PR covers the paths where secrets are formatted for logging:
- the logger's
formatArgs(so whole-object logs likecli.ts'sparsed:dump andloadConfig'scliOptionsare scrubbed) - the
docker runcommand string logged at-vv System.run's captured-output debug dump, redacted before truncation
It deliberately does not cover live-streamed subprocess output.
The gap
System.run() defaults to silent: false, so Docker.run() writes the child's stdout/stderr straight through to CI logs as it arrives. Those chunks are never redacted.
This is not a regression — that output was equally unredacted before #246 — but it is the one remaining place a registered secret can reach a log.
Why it wasn't fixed in #246
Doing it correctly is more than wrapping each chunk in SecretRedaction.redact():
- Chunk boundaries. A secret can be split across two
dataevents, so a naive per-chunk redact misses it. It needs a retained tail of at leastmaxSecretLength - 1bytes carried between chunks. - Throughput. This stream carries whole Unity build logs (multi-MB). A regex pass per registered secret per chunk is a real cost on the hot path, unlike the
-vv-gated paths #246 touched. - Fidelity.
runResult.outputshould stay unredacted so callers such asUnityBuildValidation.validateBuildkeep matching on the true text. Only what is written out should change.
Suggested approach
- A small streaming redactor holding a carry-over tail sized from the longest registered secret.
- Apply it only on the write-out path, leaving
runResult.outputuntouched. - Skip the work entirely when no secrets are registered, which is the common case and already how
SecretRedaction.redactbehaves. - Test: a secret deliberately split across two chunk boundaries.
References
- Review thread: https://github.com/game-ci/cli/pull/246#discussion_r3939465647
- Relevant code:
src/model/system/system.ts,src/model/secret-redaction.ts
- Ngôn ngữ chính
- TypeScript
- Star
- 20
- Fork
- 11
- Merge trung bình
- 5 giờ 28 phút
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 game-ci/cli
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 73/100
-
Forward Unity logs to consoleĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 32/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
open-webui/tether#52 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`void platform install --app-access public` fails when Cloudflare reports Access is disabledĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/void#835 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
AykutSarac/jsoncrack.com#616 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
melgarafael/DeskcommCRM#4679 ·
Maintainer thường phản hồi trong vòng 1 ngày