Skip to content

Env file always overridden by environment #40

@scalen

Description

@scalen

Problem

In Kubernetes, sensitive values cannot be safely stored in the containers environment as this is exposed to any who can view a pod's spec: this is usually a broad selection of people. However, they can be safely stored in Secrets, which can be safely mounted to files in the container: Secrets are usually encrypted at rest, and can have much tighter restriction on who can read/write them without impairing the maintenance of the cluster.

Unfortunately, file contents are lower priority than environment variables in envparse, meaning that anyone with the ability to write environment variables to a pod can supersede more sensitive/controlled values that have been set in an env file sourced from a mounted Secret.

Proposal

We can add a flag to the read_envfile method that will switch the behaviour from setdefault to a straight assignment, allowing people to choose to prioritise environment variables or env file contents when there is a conflict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions