Import failure text reaches the History API unfiltered
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
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 内容生成。
描述
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
setsMessage = result.Message ?? $"{result.Action} completed".DownloadProcessingJobProcessor.History.cs:65-76putsresult.Message,result.SourcePath
andresult.FinalPathintodetails["FailedResults"], serialized intoHistory.Data.listenarr.api/Features/ActivityHistory/HistoryController.csreturns the entities with
Ok(history)andOk(new { entry, related }), soHistory.MessageandHistory.Data
are response fields.
ImportResult.ImportFailurebuilds 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.Exceptionpasses the
caught exception's message through, and anIOExceptionfrom 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:256listenarr.application/Downloads/Import/DownloadImportService.cs:483
Everywhere else in the same area the repository already routes this text through
LogRedaction.SanitizeFilePathandLogRedaction.SanitizeText, includingFileMover's own
LogMutationandDownloadImportService.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
- 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. - If the raw text is kept, sanitize it on the way into the row and cap its length, matching
whatLogRedaction.SanitizeTextalready does for logs. - Independently, fix the two interpolated templates at
DownloadImportService.cs:256and
:483to pass the path as a structured argument throughLogRedaction.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 分钟
- 30 天内合并 PR
- 60
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Listenarrs/Listenarr 的其他 Issue
-
Search button on a book does not retry without the author when the full query finds nothing可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
Listenarrs/Listenarr#1173 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
Listenarrs/Listenarr#1133 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
Listenarrs/Listenarr#1128 ·
维护者通常 1 天内回复
-
Add New's search splits a title that contains "Series:", "Author:"… as if they were search keywords未关闭
难度 2/5 1-3 小时 新手友好度 88/100
Listenarrs/Listenarr#1127 ·
维护者通常 1 天内回复
-
p3
难度 2/5 1-3 小时 新手友好度 77/100
Listenarrs/Listenarr#971 ·
维护者通常 1 天内回复
查看 Listenarrs/Listenarr 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
conductor-oss/csharp-sdk#183 ·
-
CreateNewLangProj throws when the default analysis writing system's ICU locale differs from its tag未关闭
难度 2/5 1-3 小时 新手友好度 76/100
-
kind/bug
难度 2/5 1-3 小时 新手友好度 78/100
unoplatform/uno#26555 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
CactuseSecurity/firewall-orchestrator#5739 ·
维护者通常 1 天内回复
-
Bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复