Skip to content

Prevent log shipping from exposing secrets in pre-upgrade containers #470

Done

Description

@samuelmbabhazi

Priority: P1, from the 2026-11-25 security audit. Related feature: #232.

The log shipper introduced by #464 can send existing containers' secret environment values without redaction after an agent upgrade. The redactor trusts a new Docker label that those containers do not have.

Audited revision: 1295e534d7a1c3cd0a492449de8806aa532a4924. The affected functions are unchanged from the #464 revision used for the Docker reproduction.

Preconditions and impact

  • Logs are enabled on the control plane.
  • A managed application container was created before sk.secret_env was introduced and remains running after the agent upgrade.
  • The container has an injected secret environment variable of at least eight bytes, and the application printed its value into logs still retained by Docker.

The upgraded shipper reads those logs and sends the value without masking. The normal ingestion path can then retain it in VictoriaLogs, where readers with environment.read on the application's environment can access it. The secret-value API does not otherwise expose these values. This does not bypass organization isolation and does not require a malicious registry or a compromised agent.

The problem expands exposure beyond the existing, documented storage of container environment variables in root-accessible Docker state. It does not make an application print a secret it never logged.

Cause

  • container_spec.go:87–90 writes the new label when creating a container with secrets. It does not update existing containers.
  • shipper.go:227–234 obtains secret names exclusively from this label, then sends each redacted line. There is no legacy metadata recovery or refusal to collect when the label is absent.
  • redact.go:24–36 produces an empty redaction set when no names are supplied.
  • The log-reading endpoint uses environment.read.

Absence is ambiguous: a new container with no secrets also receives no sk.secret_env label. It cannot safely mean “the container is known to have no secrets.”

Verification

A bounded reproduction ran the real Docker client, log framing and Shipper.Run against disposable BusyBox containers, capturing outbound batches through a test stream. Each container had no network, a read-only root, a non-root user and a 32 MiB memory limit. Only synthetic credentials were used; the containers were removed afterwards.

Two otherwise equivalent cases produced:

Existing-container metadata, no sk.secret_env:
  token=sk_test_fake_upgrade_secret
New metadata, sk.secret_env=TOKEN:
  token=[redacted]

The Go tests passed with -race. This verifies plaintext emission by the actual shipper with real Docker logs. The reproduction did not run a full gateway/VictoriaLogs/browser chain; persistence and reader exposure follow from the reviewed ingestion and query paths.

Expected correction and acceptance

  • Establish reliable secret-name metadata for existing containers, or refuse/suspend their log collection until that metadata is available. Do not silently interpret missing metadata as “no secrets.”
  • Distinguish explicitly between known empty metadata and missing metadata without storing secret values in labels or the journal.
  • Add an upgrade regression test: an older container prints a synthetic secret, the newer shipper starts, and neither retained backlog nor new output exposes it in outbound batches.
  • Cover older containers with and without secrets and newly created containers with an explicitly empty secret set.
  • Keep cursor advancement tied to acknowledged, safely processed output. Document any compatibility limitation or required redeployment.

Activity

  1. added
    bug
    priority:P1
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P1securitytrack:agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions