Skip to content

Security issue MYSQL_PASSWORD as ENV variable #10

@mazoo

Description

@mazoo

Thanks for your great work, especially for this article.

Although we have carefully crafted this example it may contain bugs, security issues or other problems that we were not aware of at the time.

Here is what we do:
Using the swarm mode of Docker, we create Docker Secrets.

Instead of

MYSQL_PASSWORD | MySQL password | secure

we're using:

MYSQL_PASSWORD | MySQL password | secure or /run/secrets/MYSQL_PASSWORD

The place, where we need it, we do something like:

$password = $is_dev ?  $_ENV['MYSQL_PASSWORD'] : trim(file_get_contents($_ENV['MYSQL_PASSWORD'])),

So, if $is_dev, we can use it as plaintext, otherwise we get the output from our docker secret.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions