Skip to content

Build-arg secrets are stored in plain text in container labels #4

Closed

Description

@michaelaguiar

Problem

When a project builds from its own Dockerfile, alios start asks for the value of every ARG that has no default (promptForBuildArgs). It then stores the answers on the container as the alios.project.build_args label (project.Manager.createContainer, serializeBuildArgs), so later rebuilds don't have to ask again.

Dockerfiles commonly use exactly these no-default ARGs for credentials, e.g. ARG GITHUB_TOKEN for pulling private Composer packages. That means:

  • Labels: the secret sits in plain text in the container's labels. Anyone or anything that can run docker inspect can read it, and so can anything with Docker socket access (the new alios_idle service in Scale to zero: stop idle projects, start them on the next visit #3, Portainer, and so on). It also ends up in any docker inspect output pasted into a bug report.
  • Build arguments: docker.Client.BuildImage passes each value as --build-arg KEY=value, so it shows in ps while a build runs.

Found on a real project. A GitHub OAuth token (gho_…) is in the label of one local project container. It isn't in that image's docker history.

Proposed fix

  1. Stop persisting secret values. For keys that look like credentials (*TOKEN*, *SECRET*, *PASSWORD*, *_KEY, *AUTH*), store only the key name in the label. At build time, read the value from the same-named environment variable, and prompt only if it isn't set. Non-secret build args keep working as they do now.
  2. Pass secrets as BuildKit secrets. Pass them as --secret id=KEY,env=KEY instead of --build-arg, so they never reach argv or the image. Dockerfiles opt in with RUN --mount=type=secret,id=GITHUB_TOKEN …. For Dockerfiles that still use ARG, keep --build-arg, but take the value from the environment (--build-arg KEY with no value) so it stays out of argv.
  3. Migrate. On the next alios start or alios rebuild, drop secret values from existing labels. That needs a container recreate, the same path alios env uses.
  4. Doctor. alios doctor warns when a container label holds a credential-looking build arg value.
  5. Docs. Recommend BuildKit secrets in the README's image-selection section.

For whoever is affected now

Rotate any token that was entered at the build-arg prompt. It's readable from docker inspect on that project's container.

Activity

  1. linear-code commented on Oct 14, 2026

    @linear-code
  2. michaelaguiar commented on Oct 14, 2026

    @michaelaguiar
    MemberAuthor

    Tracked in Linear as ALI-837, along with rotating the glowhouse token.

  3. michaelaguiar commented on Oct 28, 2026

    @michaelaguiar
    MemberAuthor

    Fixed in #14, released in v2.2.0. Build args whose names look like credentials are now saved by name only. Their values reach docker build through its environment rather than its command line, and come from INGOT_BUILD_ARG_<NAME> or a prompt. ingot doctor warns when a container still holds a value saved by an older version.

    If you used a token build arg on an older version, revoke that token (it was readable from docker inspect), then run ingot rebuild in the project.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions