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

オープン 初心者向け
#705 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

@LeeroyHannigan がすでに取り組んでいます。

2026年11月3日 から。

  • #772 @LeeroyHannigan による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
backend, security

調査の方向性

crates/engine/src/import_export.rs の log 呼び出し(248~254行目付近)を確認してください。ここでは resolved_path を Display で整形しています。また crates/engine/src/import_export_io.rs の validate_path_parent(327~407行目)も確認してください。フィールドを Debug に切り替えるか、FilePath で制御文字を拒否するかを決めてください。そのうえで import_export_io.rs に、名前に \n、\r、\x1b が含まれる場合は拒否されることを確認する単体テストを追加してください。これらのテストが通り、ログを取得するサーバーテストで、改行を含むパスのエクスポートがちょうど1行のログを書くことが示されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
517
フォーク
60
平均マージ
4日 19時間
マージ済み PR(30日)
50

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ExtendDB/extenddb のほかの issue

ExtendDB/extenddb の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。