Skip to content

fix: keep .env files out of the image build #361

Closed

Description

@uniqueg

Problem

.dockerignore excludes everything (*) and then re-includes pro_tes/ as a whole (!pro_tes/). A local pro_tes/.env (or a key file such as pro_tes/*.pem) is therefore sent to the build and lands in the layer of COPY pro_tes /tmp/src/pro_tes (Dockerfile). The later rm -rf /tmp/src does not remove it from that layer, so it ships with the image. This breaks the org rule that build contexts exclude .env* (except .env.example) and other secret files. Unchanged since v0.3.0; found by the pre-release review of 0.4.0.

Proposed fix

Append to .dockerignore, after the re-includes:

**/.env*
!**/.env.example
**/*.pem
**/*.key

and add a test that keeps these patterns in place.

Acceptance criteria

  • .env* files (except .env.example), *.pem and *.key files anywhere in the build context, also under pro_tes/, are excluded.
  • A test fails if the patterns are removed or a later re-include overrides them.

Activity

  1. added this to the v0.4.0 milestone on Oct 31, 2026
  2. added
    priority: high
    status: in progress
    type: security
    workload: minutes
    on Oct 31, 2026
  3. removed
    status: in progress
    on Oct 31, 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

    priority: hightype: securityworkload: minutes

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions