# GHSA-8W38-MP5Q-MP8M: Repository credentials still logged in cleartext after the fix for GHSA-v6mg-7f7p-qmqp

- Database: GitHub
- Severity: CVSS 7.5 (High)
- Published: 2026-12-03
- Modified: 2026-12-03

## Tracked as

- [CVE-2026-141356](https://cve.now/CVE-2026-141356.md): apko and melange expose repository credentials in build output

## Affected versions

- chainguard.dev/apko (Go): fixed in 1.5.6
- chainguard.dev/melange (Go): fixed in 0.66.1

## Description

### Impact

apko accepts HTTP basic-auth credentials in repository URLs (`https://user:pass@host/...`). The fix for [GHSA-v6mg-7f7p-qmqp](https://github.com/chainguard-dev/apko/security/advisories/GHSA-v6mg-7f7p-qmqp) (CVE-2024-36127, commit 2c0533e4) redacted those URLs only when the image configuration is marshalled to YAML. Log statements and error messages that format repository URLs directly still write the username and password in cleartext.

Logs from apko, and from tools that embed it such as melange, often end up in CI output. On public repositories that output is world-readable.

### Affected data paths

At `main` `0408833b`:

1. [`(*APK).InitRuntimeOnlyKeys`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/pkg/apk/apk/implementation.go#L477) logs the runtime-only repository URL at **warn**. Key discovery rejects any URL that contains user info ([`canonicalHTTPOrigin`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/pkg/apk/apk/implementation.go#L1330)), so for a credentialed runtime-only repository this line fires on every build, with no network failure needed.
2. [`(*ImageConfiguration).Summarize`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/pkg/build/types/image_configuration.go#L311-L313) logs build, runtime-only and main repositories at **info**. melange calls `Summarize` on every build.
3. Package fetch errors include the raw URL: [`package_getter.go`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/pkg/apk/apk/package_getter.go#L378-L382), [`httpStatusError.Error`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/pkg/apk/apk/package_getter.go#L95) and [`transport.go`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/pkg/apk/apk/transport.go#L108-L111). They reach the **warn**-level retry log and the final error on any 5xx or 429 response.
4. **debug** level: [`(*APK).SetRepositories`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/pkg/apk/apk/repo.go#L108), [`(*APK).fetchChainguardKeys`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/pkg/apk/apk/implementation.go#L1603) and the key-discovery lines in [`apko lock`](https://github.com/chainguard-dev/apko/blob/0408833b19c8187e2d2329d7cb47e610356225cd/internal/cli/lock.go#L353-L384).
5. The `redact()` helper itself did not redact a URL that fails to parse, for example one whose password contains an unescaped `/`, `?` or `#`, as base64 tokens often do. Such URLs kept their credentials in every redacted log line and error, including path 1.
6. The on-disk package and index cache. Each repository's cache directory was named after its URL, password included. Cache paths appear in debug logs and errors, and the password stays on disk in the directory name. CI jobs that save or upload the apk cache directory publish it.
7. Trace spans. On a package cache miss, the span name contained the full package URL, so anyone exporting apko traces received the password.

### Attack prerequisites

1. A build configures at least one repository URL with embedded credentials.
2. The attacker can read the build's log output, for example the CI logs of a public repository.

Paths 1 to 3 need only the default log level.

### Affected versions

apko releases through 1.5.5, and melange releases through 0.66.0, which log repositories through apko's `Summarize`.

### Reproduction

Against `main` at `0408833b`, with the repository `https://apkuser:SUPERSECRET@127.0.0.1:1/os`:

1. Call `InitRuntimeOnlyKeys` with a logger at info level. The warn line contains `SUPERSECRET`.
2. Call `Summarize` on an `ImageConfiguration` that lists the repository, at info level. The output contains `SUPERSECRET`, while `yaml.Marshal` of the same configuration does not.
3. Call `SetRepositories` and `fetchChainguardKeys` at debug level. Both lines contain `SUPERSECRET`.

### Patches

Fixed in apko 1.5.6. Every repository and key URL is now redacted before it is logged or put in an error, and URLs that fail to parse are fully redacted. melange users should upgrade to melange 0.66.1 or later.

After upgrading, delete any apk cache directory filled from repository URLs with credentials in them; their names contain the password. Online builds refill the cache automatically. Offline builds that use a cache filled by an earlier release fail until it is refilled with the fixed release.

### Workarounds

* Supply repository credentials through `HTTP_AUTH` rather than in the repository URL.
* Do not publish apko or melange build logs from builds that use credentialed repository URLs.

## References

- https://github.com/chainguard-dev/apko/security/advisories/GHSA-8w38-mp5q-mp8m

Page: https://cve.now/GHSA-8W38-MP5Q-MP8M

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
