Export and import paths can write CR, LF and terminal escape sequences into the server log

Đang mở Phù hợp với người mới
#705 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 4 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
62/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ệ
rust
Lĩnh vực
backend, security

Hướng nghiên cứu

Bắt đầu từ lệnh gọi log trong crates/engine/src/import_export.rs (khoảng dòng 248-254), lệnh này định dạng resolved_path bằng Display, và từ validate_path_parent trong crates/engine/src/import_export_io.rs (dòng 327-407). Quyết định xem nên chuyển trường sang Debug hay từ chối ký tự điều khiển trong FilePath, rồi thêm một unit test trong import_export_io.rs xác nhận các tên chứa \n, \r hoặc \x1b bị từ chối. Hoàn thành khi các test này pass và một server test bắt log cho thấy việc export một đường dẫn có ký tự xuống dòng ghi đúng một dòng log.

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

Mô tả

bug security

Problem

ExportTableToPointInTime logs the path it writes to with a Display field, resolved_path = %output_path.display() (crates/engine/src/import_export.rs:248-254). validate_path_parent (crates/engine/src/import_export_io.rs:327-407) refuses .., symlinks and paths outside the account's directory under an [export] paths root, and accepts every other byte in the file name, including CR, LF and ESC. The default pretty log format writes Display fields without escaping them.

A principal allowed to call ExportTableToPointInTime on a server with export paths configured can therefore end the log line early, add text formatted as a log line of its own, and send ANSI escape sequences to an operator who reads the log in a terminal. In --foreground mode (containers, systemd Type=simple) the log goes to stderr. In daemon mode it goes to syslog, where the result depends on how the syslog daemon handles control characters.

ImportTable logs its resolved path the same way (import_export.rs:60-66), but its file must already exist under an import root.

The caller gains no access it did not have. An operator who reads the log as an audit record can be misled by the added lines.

Reproduction

A SQLite build of 1c0523c9 running serve --foreground with the default log format and [export] paths set, and a user allowed dynamodb:ExportTableToPointInTime on a table:

  1. Call ExportTableToPointInTime with the table's TableArn and a FilePath under the account's export directory whose file name is x, then \n, then 2026-10-31T23:59:59.000000Z INFO extenddb_server::management: admin login succeeded user=admin, then \r\n\x1b[31mred\x1b[0m.json.
  2. The call returns 200 and creates a file with those bytes in its name.
  3. The server log shows the added text as a line of its own, starting at column 1 with its own timestamp. The next line starts with the raw escape sequence.

The same request with the path in S3Prefix in place of FilePath also returns 200 and adds the line.

The code is the same on main at f49c5f823.

Expected

The log line carries the path with control characters escaped, for example through a Debug field (resolved_path = ?output_path), so a path cannot start a new log line. FilePath is ExtendDB's own parameter and names a local file, so it can also refuse control characters (U+0000 to U+001F and U+007F) with a ValidationException. How DynamoDB answers a control character in S3Prefix has not been measured.

Tests: a unit test in import_export_io.rs that a file name holding \n, \r or \x1b is refused, and a server test that captures the log and checks that an export writes one log line.

Ngôn ngữ chính
Rust
Star
517
Fork
60
Merge trung bình
5 ngày 5 giờ
Pull request đã merge (30 ngày)
41

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

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 ExtendDB/extenddb

Tất cả issue của ExtendDB/extenddb

Issue tương tự

Thêm issue về Rust

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.