Skip to main content
Menu
Advisories

melange initramfs and source get log repository and git credentials in cleartext

GHSA-79G8-Q97F-VCVWPublished Updated GitHub

Description

Impact

melange accepts credentials in apk repository, keyring and git URLs (https://user:pass@host/...). Two melange commands write those URLs to their logs, or into errors, without redacting them. Logs from melange often end up in CI output. On public repositories that output is world-readable.

This is separate from GHSA-8w38-mp5q-mp8m, which covers repository credentials that melange logs through apko. These leaks are in melange's own code.

Affected data paths

At v0.66.0:

  1. melange initramfs logs every --repository and --keyring URL at info.
  2. melange source get logs the git-checkout repository URL at info (Cloning <url> to <dir>).
  3. When that clone fails, the error repeats the URL. Go's HTTP client hides a password in it, but not a token passed as the user name (https://TOKEN@host/...). If the URL does not parse, for example because the password has an unescaped /, the error quotes part of the password.

Affected versions

melange 0.46.0 through 0.66.0. Path 1 was added in 0.46.0, and paths 2 and 3 in 0.46.1.

Patches

Fixed in melange 0.66.1 (chainguard-dev/melange#2774). The URLs are redacted before they are logged or put in an error. A git URL loses its whole user info, so a token passed as the user name is removed too.

Workarounds

  • For melange initramfs, supply repository credentials through HTTP_AUTH rather than in the URL.
  • Do not publish logs from melange initramfs or melange source get runs that use credentialed URLs.

Affected versions

References

GitHub · chainguard-dev/melange