EPIC: Remove source locations from errors

未关闭
#2,912 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
15/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
backend

调研方向

Start with docs/issues/open/2912-remove-source-locations-from-errors/EPIC.md and the audit record in docs/issues/open/2804-location-caller-track-caller-audit/. The work is divided into seven ordered sub-issues, and the maintainer requires one session at a time with approval to start each; SI-1 must precede code changes. For any assigned sub-issue, follow its scope and verify its stated outcome; the epic's overall goal is to remove source locations from errors and add a repository check.

由索引模型根据 Issue 内容生成。

描述

EPIC

Goal

No error in the workspace records or prints a source location. Error types have no location field, the workspace does not use torrust-located-error, and no text sent to an HTTP, UDP or REST client, an event consumer or an operator holds a source file path. A repository check keeps it so.

Why

The audit of #2804 shows that the recorded location is wrong by construction: none of the 38 production Location::caller() sites of the audit (37 since #2850) is in a #[track_caller] function, and #[track_caller] cannot fix them, because they are reached through str::parse, try_into, closures or async code. The value still reaches clients: 23 Display formats print it, and LocatedError prints its own. It appears in the HTTP tracker failure reason, UDP error messages, REST API errors, event payloads and logs. It was reported as a security concern in #384, it lets an attacker infer the running version, it couples client-visible messages to the code layout, and it costs public API (24 public enum variants). Developers keep file and line on the server through tracing events.

Maintainer decisions (2026-11-17)

  • Remove the field entirely (option 4 of the #2804 analysis), with messages that name what failed. Stripping it from Display only was rejected.
  • #384 keeps its title and becomes the final sub-issue (client-side recheck).
  • One sub-issue session at a time, each started after the maintainer's go.
  • No parent EPIC.

Sub-issues (in order)

  1. SI-1: ADR "Errors do not record source locations" and the handle-errors-in-code skill update. Goes first; no code before it.
  2. SI-2: torrust-tracker-primitives (includes the PeerRole parse finding). Before the primitives 4.0.0 publish.
  3. SI-3: HTTP tracker request errors (http-protocol, axum-http-server extractors). Largest client-visible exposure.
  4. SI-4: torrust-tracker-core errors and their consumers.
  5. SI-5: configuration, TLS (axum-server) and udp-server errors. Before the configuration 4.0.0 publish.
  6. SI-6: drop torrust-located-error from the workspace, add a repository check, and draft the upstream issues for torrust-info-hash and torrust-located-error.
  7. #384: client-side verification on a running tracker, then close.

Specification

docs/issues/open/2912-remove-source-locations-from-errors/EPIC.md (added by the spec-only PR). Audit record: docs/issues/open/2804-location-caller-track-caller-audit/.

Related: #2804, #384, #2583 (first publish of the workspace crates), #1347.

主要语言
Rust
星标
532
派生
56
平均合并
11 小时 20 分钟
30 天内合并 PR
282

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

torrust/torrust-tracker 的其他 Issue

查看 torrust/torrust-tracker 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。