Skip to content

fix(security): stop leaking DSM credentials (login URL + record ToString)#8

Merged
ChrisonSimtian merged 1 commit into
mainfrom
fix/secret-leaks-and-login-post
Jun 1, 2026
Merged

fix(security): stop leaking DSM credentials (login URL + record ToString)#8
ChrisonSimtian merged 1 commit into
mainfrom
fix/secret-leaks-and-login-post

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Problems (2× MEDIUM)

  1. Credentials in the login URL (CWE-598). SynologyApiClient.LoginAsync sent account + passwd in the auth.cgi query string of a GET, so they landed in DSM access logs, any reverse-proxy logs, and HttpClient request-URI logging — even over TLS.
  2. Secrets in record.ToString(). SynologyOptions and SynologySshOptions are records whose synthesized ToString() printed Password, leaking it into any log/interpolation.

Fixes

  1. Send the SYNO.API.Auth parameters as a POST form body (FormUrlEncodedContent, which also handles escaping). DSM 7.x accepts form fields on auth.cgi.
  2. Override ToString() on both records to emit Password = ***.

Adds a regression test asserting the password never appears in ToString(). Builds clean, tests green (18 passed, 2 skipped).

Note: the cached _sid session id is still appended to entry.cgi URLs (same family, lower severity) — left as-is here to avoid changing the read path without a live DSM to test against. Tracked alongside #7.

🤖 Generated with Claude Code

…ing)

Two credential-exposure fixes:

1. LoginAsync sent account + password in the auth.cgi *query string* of a
   GET, so they landed in DSM access logs, proxy logs, and HttpClient
   request-URI logging even over TLS (CWE-598). Send the SYNO.API.Auth
   parameters as a POST form body instead.

2. SynologyOptions and SynologySshOptions are records whose synthesized
   ToString() printed Password — leaking it into any log/interpolation.
   Override ToString() to emit `Password = ***`.

Adds a regression test asserting the password never appears in ToString().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian
ChrisonSimtian merged commit 3223a57 into main Jun 1, 2026
1 check passed
@ChrisonSimtian
ChrisonSimtian deleted the fix/secret-leaks-and-login-post branch June 1, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant