Skip to content

config: redact HTTP include passwords from logs and errors - #508

Open
inqrphl wants to merge 1 commit into
mainfrom
config-http-passwords-security-fixes-1
Open

inqrphl wants to merge 1 commit into
mainfrom
config-http-passwords-security-fixes-1

Conversation

@inqrphl

@inqrphl inqrphl commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Disclaimer: The code changes in this pull request are AI generated and human reviewed.

Summary

HTTP(S) config includes can carry basic-auth credentials in the URL userinfo. The include code logged the raw URL and included it in returned errors, so the password could reach the agent log, journald, log shippers, backups, or the admin log download.

This change adds a redactURLPassword helper and uses it for every include log and error path and for the cached-ini source header. httpDo now also redacts its trace and error messages, including URL parse errors. The raw URL is still used for the HTTP request, so authentication behavior is unchanged.

Tests

  • Added a regression test for trace, debug, WARN, and config-error output using an unreachable loopback URL and an expired include cache.
  • Added unit tests for the redaction helper, including malformed URLs.
  • make fmt, make golangci, and make test pass.
  • make citest passed the code stages and stopped at docscheck because the docs test could not install muffet into a read-only Go module cache. This is an environment limitation.

HTTP include URLs can carry basic-auth credentials in the userinfo part. Logging or returning the raw URL exposed the password in the agent log, journal, or admin log download.

Redact the password before every log statement and error message while keeping the raw URL for the actual HTTP request.
@inqrphl
inqrphl requested a review from sni November 26, 2026 17:50
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