Repository navigation
Description
Goal
Adopt the Rust secrecy crate for configuration API tokens in both v2 and v3. This makes tokens explicit in the Rust type system, redacts them from Debug and Display output, clears them from memory when dropped, and makes intentional exposure reviewable.
Scope
- Add
secrecywith the supported serialization configuration. - Change v2 and v3 API tokens to
Secret<String>without changing TOML syntax. - Update authentication, bootstrap, tests, logging, tracing, error, and output boundaries so
.expose_secret()occurs only where authentication needs the token. - Add regression tests for the exact
Secret([REDACTED])representation and to ensure test tokens do not appear in output. - Preserve legacy v2 and current v3 database URLs as plain strings with their existing
mask_secrets()behavior. - Update secret-handling policy documentation.
Sequencing and release gate
This is implemented before #1490. It establishes the Secret<String> convention for API tokens while deliberately leaving legacy database URLs unchanged. #1490 subsequently decomposes v3 database configuration and uses Secret<String> for its new isolated database password.
Both #2079 and #1490 must be merged before publishing a torrust-tracker-configuration release exposing the v3 types. Changing public fields from String to Secret<String> is semver-breaking for Rust consumers.
Out of scope
- Changing v2 or v3 TOML syntax.
- Wrapping legacy database URLs in
Secret<String>. - Database configuration decomposition; tracked by Decompose v3 database configuration #1490.
- Encrypting configuration files at rest.
- A custom secret-wrapper type.
Verification
- Run focused configuration, REST API server, and tracker-core tests.
- Run the workspace test suite and
linter all. - Verify v2 and v3
Debugformatting uses exactlySecret([REDACTED])for test API tokens. - Verify authentication receives the actual token only at its runtime integration boundary.
- Verify tokens do not occur in logs, tracing output, errors, or CLI JSON output.
References
- Follow-up: Decompose v3 database configuration #1490
- Related: API token revealed in logs via tracing instrumentation #1441
- External rationale: Torrust Tracker Deployer secrecy ADR
The Git-tracked implementation specification is the source of truth:
docs/issues/open/2079-adopt-secrecy-for-sensitive-configuration.md. This GitHub body is a summary and may become stale.
Activity
josecelano commentedon Aug 21, 2026
This issue is the prerequisite API-token secrecy refactor for #1490. It intentionally retains legacy database URLs and their manual masking; #1490 subsequently isolates the v3 password and represents it as
Secret<String>.\n\nFor implementation, the Git-tracked specification is the source of truth:docs/issues/open/2079-adopt-secrecy-for-sensitive-configuration.md. The GitHub issue body is informational and may be stale.Merge #2078: docs(issues): replan database secret handling (#1490)