mealie-recipes / mealie

Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
https://docs.mealie.io
GNU Affero General Public License v3.0
6.76k stars 697 forks source link

Setting backend passwords with docker compose secrets #3656

Closed aljora closed 4 months ago

aljora commented 4 months ago

What type of PR is this?

What this PR does / why we need it:

This change would allow administrators to share their secrets with the mealie container without needing to enter them through the environment variables, which could possibly expose them to other processes.

It was chosen to hard-code the path to avoid needed to process environment variables before the pydantic object was created. By default Docker places all secrets in files according to their names into a single directory. This supports the default use case but would need further effort to support other paths.

Which issue(s) this PR fixes:

Fixes #3606

Special notes for your reviewer:

Automated testing was considered but I did not want to inconvenience all other developers on this project by making them declare secrets in their dev containers or machines. Is there a need to create a CI workflow that uses a custom container to run tests?

Testing

The change was verified by running the production container with and without the secrets directory present. With the secrets directory, the content of the secret was evident in the logs showing that the information reached the backend successfully. Note that this PR does not address whether or not secrets are compromised by appearing in the logs. With the directory absent, the logs include a warning per the pydantic docs.

boc-the-git commented 4 months ago

@aljora this PR is in draft state, is that intentional?

aljora commented 4 months ago

@aljora this PR is in draft state, is that intentional?

Yes, I wanted to put this up there while I was confirming usage and writing documentation. I'll move it to the ready state.

Kuchenpirat commented 4 months ago

Hey, thanks for your work on this :)

Tested it and works for me 👍 Will leave it open for @boc-the-git to merge :)