Import failure text reaches the History API unfiltered

オープン
#975 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

まだ誰も着手していません。

評価

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

調査の方向性

Start with DownloadProcessingJobProcessor.cs:346, DownloadProcessingJobProcessor.History.cs:65-76, and HistoryController.cs to trace how failure text reaches History responses. Then compare the existing LogRedaction.SanitizeFilePath and SanitizeText uses, and inspect the two log templates in DownloadImportService.cs:256 and :483. Done means path details are not exposed in History and the two log sites follow the repository's redaction pattern.

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

説明

p2

Filed from the batch G review of PRs 916 and 930. Pre-existing on canary a630572e;
both of those PRs widen it, neither creates it.

What happens

A failed file import writes its message straight into a History row, and History rows are
returned whole:

  • listenarr.infrastructure/Downloads/Processing/DownloadProcessingJobProcessor.cs:346
    sets Message = result.Message ?? $"{result.Action} completed".
  • DownloadProcessingJobProcessor.History.cs:65-76 puts result.Message, result.SourcePath
    and result.FinalPath into details["FailedResults"], serialized into History.Data.
  • listenarr.api/Features/ActivityHistory/HistoryController.cs returns the entities with
    Ok(history) and Ok(new { entry, related }), so History.Message and History.Data
    are response fields.
    ImportResult.ImportFailure builds its message as
    $"Unable to perform {action} on {sourcePath} to {finalPath}", so the absolute source and
    destination paths are already in that response today. ImportResult.Exception passes the
    caught exception's message through, and an IOException from the file layer normally quotes
    the path again and adds the platform error text.
    Two adjacent log sites interpolate the same path into the message template rather than
    passing it as a structured argument, so neither is sanitized and neither can be filtered by
    field:
  • listenarr.application/Downloads/Import/DownloadImportService.cs:256
  • listenarr.application/Downloads/Import/DownloadImportService.cs:483
    Everywhere else in the same area the repository already routes this text through
    LogRedaction.SanitizeFilePath and LogRedaction.SanitizeText, including FileMover's own
    LogMutation and DownloadImportService.DirectoryOwnership.cs:277-280. These call sites are
    the exception rather than the policy.

Why it matters

The History API is how the web UI draws the activity list, so this text is rendered to anyone
who can reach the instance. On a shared or reverse-proxied deployment the response describes
the host's directory layout, and on Windows the paths usually contain the account name.

How Readarr handles the same split

Readarr keeps the two audiences apart deliberately. ImportApprovedBooks.cs:271-306 logs the
exception object, so the log keeps everything, and then records a fixed classified sentence in
the user-visible result: "Failed to import book, permissions error", "Failed to import book,
root folder missing", "Failed to import book, destination already exists". The raw exception
text never reaches ImportResult.Errors (ImportResult.cs:30-37).

Suggested change

  1. Classify at the boundary. Map the failure to a short stable sentence for History.Message,
    the way Readarr does, and keep the exception object for the log.
  2. If the raw text is kept, sanitize it on the way into the row and cap its length, matching
    what LogRedaction.SanitizeText already does for logs.
  3. Independently, fix the two interpolated templates at DownloadImportService.cs:256 and
    :483 to pass the path as a structured argument through LogRedaction.SanitizeFilePath.
    Item 3 is small and self-contained and could land on its own.
    Disclosure: drafted with Claude Code at my direction; I read the cited code at the stated commit and reviewed this before posting.
主要言語
C#
スター
901
フォーク
70
平均マージ
16時間 27分
マージ済み PR(30日)
60

環境構築

はじめの一歩

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

Listenarrs/Listenarr のほかの issue

Listenarrs/Listenarr の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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