[PR #3353] fix(security): prevent proxy secrets from leaking into logs #3220

Open
opened 2026-10-30 04:58:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3353
Author: @DaMistic727
Created: 10/29/2026
Status: 🔄 Open

Base: dev ← Head: fix/redact-proxy-secrets-from-logs


📝 Commits (1)

  • fd63da0 fix(security): prevent proxy secrets from leaking into logs

📊 Changes

4 files changed (+249 additions, -5 deletions)

View changed files

📝 client/core/controllers/selfhosted/installController.cpp (+1 -5)
📝 client/core/controllers/selfhosted/installController.h (+2 -0)
📝 client/tests/CMakeLists.txt (+10 -0)
➕ client/tests/testProxyConfigurationLogging.cpp (+236 -0)

📄 Description

Problem

Installing or reconfiguring a self-hosted MTProxy or Telemt service can put proxy access credentials in the application's diagnostic log when logging is enabled. Exporting the log archive can then disclose those credentials to its recipient.

Confirmed against dev at 7f9b7db482b8b1662b7466937e578008cbcb716e.

Root cause

The configure scripts intentionally return machine-readable credentials. MTProxy returns the base secret and credential-bearing Telegram links; the current Telemt script returns the base secret and empty link markers. configureContainerWorker() collects both stdout and stderr, then updateContainerConfigAfterInstallation() logs the entire buffer in the MTProxy and Telemt branches.

Qt debug messages are forwarded to Logger, which writes them without automatic redaction. Logger::sensitive() is opt-in and is not used here. LogsController::zipAll() includes the application log. A related Docker missing/stopped error message also dumped the same buffer.

Security impact

A person with access to the local log, its console output while Logger is active, or a shared diagnostic archive can obtain proxy access credentials. This does not demonstrate unauthenticated remote log access or disclosure of SSH credentials. Application file logging is opt-in (disabled by default).

Changes

  • Remove the MTProxy and Telemt raw configure-output debug statements.
  • Keep the Docker missing/stopped diagnostic, without the accumulated output.
  • Leave all parsing, conditional field updates, configuration formats, transport modes, secret generation, and APIs unchanged.
  • Add one test-class friendship to exercise the existing private static method without extracting or duplicating production parsing.

Regression tests

Register ProxyConfigurationLoggingTest in the existing Qt/CMake test suite.

Twenty data-driven scenarios cover both services: padded/fake-TLS links, secret-only output matching the current Telemt script, links-only output, empty/incomplete/invalid/unmarked/noisy output, and repeated configuration with a different secret. Tests compare the full serialized configuration and assert that synthetic credentials, credential-bearing URLs, and a raw-output canary reach neither the Qt message handler nor the real Logger file. A control message ensures logging is active.

Only synthetic secrets and the reserved proxy.example host are used. Logger runs under Qt test mode with a unique application name; its test log is removed afterward.

Validation

  • PASSED: isolated Qt/CMake component builds on macOS arm64 with Qt 6.12.0 and AppleClang 21, in Release and Debug. These compile the complete, real installController.cpp translation unit, real config models, and Logger; unused controller dependencies are discarded by the linker. No extracted parser or mocked config model is used.
  • PASSED: new regression suite in Release and Debug: 20 scenarios plus initialization/cleanup, 22 passed, 0 failed, 0 skipped per configuration.
  • PASSED: existing LogsControllerTest in the isolated Release harness, including ZIP round-trip with Qt private headers: 11 passed, 0 failed, 0 skipped.
  • PASSED red → green: compiling the same tests against the unmodified upstream controller in Release produces 14 expected failures on credentials/raw output in the actual log file; the patched controller passes. Release uses -DNDEBUG -DQT_NO_DEBUG, demonstrating that those flags do not suppress this logging.
  • PASSED: git diff --check; repository clang-format for the new test and touched production lines; changed-file scope review.
  • NOT RUN: complete application build/full upstream CTest suite. Root CMake configure fails because Conan is not installed (Could not find CONAN_COMMAND).

Limitations

No live SSH/Docker installation, GUI export, cross-platform runtime test, or released application binary was exercised. The Docker error-output removal was compiled and reviewed but was not exercised through a live SSH failure. The component harness does not replace a full application link or upstream CI.

Previously written logs/archives are not scrubbed. Server-side secret storage and MTProxy's existing secret-bearing process arguments are outside this local diagnostic-logging fix. Public issue/PR searches and related merged MTProxy/Telemt changes did not reveal an existing fix for these logging sites.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/3353 **Author:** [@DaMistic727](https://github.com/DaMistic727) **Created:** 10/29/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/redact-proxy-secrets-from-logs` --- ### 📝 Commits (1) - [`fd63da0`](https://github.com/amnezia-vpn/amnezia-client/commit/fd63da077acf224f35c1665af433cfa6ab52eff3) fix(security): prevent proxy secrets from leaking into logs ### 📊 Changes **4 files changed** (+249 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `client/core/controllers/selfhosted/installController.cpp` (+1 -5) 📝 `client/core/controllers/selfhosted/installController.h` (+2 -0) 📝 `client/tests/CMakeLists.txt` (+10 -0) ➕ `client/tests/testProxyConfigurationLogging.cpp` (+236 -0) </details> ### 📄 Description ## Problem Installing or reconfiguring a self-hosted MTProxy or Telemt service can put proxy access credentials in the application's diagnostic log when logging is enabled. Exporting the log archive can then disclose those credentials to its recipient. Confirmed against `dev` at `7f9b7db482b8b1662b7466937e578008cbcb716e`. ## Root cause The configure scripts intentionally return machine-readable credentials. MTProxy returns the base secret and credential-bearing Telegram links; the current Telemt script returns the base secret and empty link markers. `configureContainerWorker()` collects both stdout and stderr, then `updateContainerConfigAfterInstallation()` logs the entire buffer in the MTProxy and Telemt branches. Qt debug messages are forwarded to `Logger`, which writes them without automatic redaction. `Logger::sensitive()` is opt-in and is not used here. `LogsController::zipAll()` includes the application log. A related Docker missing/stopped error message also dumped the same buffer. ## Security impact A person with access to the local log, its console output while Logger is active, or a shared diagnostic archive can obtain proxy access credentials. This does not demonstrate unauthenticated remote log access or disclosure of SSH credentials. Application file logging is opt-in (disabled by default). ## Changes - Remove the MTProxy and Telemt raw configure-output debug statements. - Keep the Docker missing/stopped diagnostic, without the accumulated output. - Leave all parsing, conditional field updates, configuration formats, transport modes, secret generation, and APIs unchanged. - Add one test-class friendship to exercise the existing private static method without extracting or duplicating production parsing. ## Regression tests Register `ProxyConfigurationLoggingTest` in the existing Qt/CMake test suite. Twenty data-driven scenarios cover both services: padded/fake-TLS links, secret-only output matching the current Telemt script, links-only output, empty/incomplete/invalid/unmarked/noisy output, and repeated configuration with a different secret. Tests compare the full serialized configuration and assert that synthetic credentials, credential-bearing URLs, and a raw-output canary reach neither the Qt message handler nor the real Logger file. A control message ensures logging is active. Only synthetic secrets and the reserved `proxy.example` host are used. Logger runs under Qt test mode with a unique application name; its test log is removed afterward. ## Validation - **PASSED:** isolated Qt/CMake component builds on macOS arm64 with Qt 6.12.0 and AppleClang 21, in Release and Debug. These compile the complete, real `installController.cpp` translation unit, real config models, and Logger; unused controller dependencies are discarded by the linker. No extracted parser or mocked config model is used. - **PASSED:** new regression suite in Release and Debug: 20 scenarios plus initialization/cleanup, 22 passed, 0 failed, 0 skipped per configuration. - **PASSED:** existing `LogsControllerTest` in the isolated Release harness, including ZIP round-trip with Qt private headers: 11 passed, 0 failed, 0 skipped. - **PASSED red → green:** compiling the same tests against the unmodified upstream controller in Release produces 14 expected failures on credentials/raw output in the actual log file; the patched controller passes. Release uses `-DNDEBUG -DQT_NO_DEBUG`, demonstrating that those flags do not suppress this logging. - **PASSED:** `git diff --check`; repository clang-format for the new test and touched production lines; changed-file scope review. - **NOT RUN:** complete application build/full upstream CTest suite. Root CMake configure fails because Conan is not installed (`Could not find CONAN_COMMAND`). ## Limitations No live SSH/Docker installation, GUI export, cross-platform runtime test, or released application binary was exercised. The Docker error-output removal was compiled and reviewed but was not exercised through a live SSH failure. The component harness does not replace a full application link or upstream CI. Previously written logs/archives are not scrubbed. Server-side secret storage and MTProxy's existing secret-bearing process arguments are outside this local diagnostic-logging fix. Public issue/PR searches and related merged MTProxy/Telemt changes did not reveal an existing fix for these logging sites. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#3220
No description provided.