Repository navigation
Support reading secrets from files (_FILE environment variables) #1815
Replies: 1 comment 1 reply
|
Thanks for the detailed request, and for the kind words. 😊 This makes sense and I'd like to add it, following the same _FILE convention as postgres and mariadb. The plan is to handle it in _env() so every variable gets a _FILE variant at once, including POZNOTE_APP_SECRET, which is currently read in a different way and would otherwise be skipped. The MCP container reads its own variables in Python, so POZNOTE_MCP_AUTH_TOKEN and POZNOTE_MCP_AUTH_CLIENT_SECRET will get the same treatment there. An unreadable file will stop with an error naming the variable and the path, never fall back to an empty secret, and setting both X and X_FILE will be refused rather than silently picking one. Only the trailing newline is stripped. One thing to keep in mind with Compose secrets is that the file is mounted with its permissions from the host, so it has to be readable by www-data inside the container. I'll let you know when there's a build to test, your authentik setup is exactly the case to check. 🙏 |
Uh oh!
There was an error while loading. Please reload this page.
📝 Your request
Hello Tim,
Thanks for Poznote. I use it every day with SSO through authentik. Love your app.
I'd like to suggest support for reading secrets from files, using the _FILE convention that images like postgres and mariadb follow. For example, if POZNOTE_OIDC_CLIENT_SECRET_FILE=/run/secrets/oidc_client_secret is set, Poznote reads the secret from that file.
Today the OIDC client secret can only come from an environment variable. Anything set through environment: or env_file: is stored in the container's configuration, so docker inspect poznote shows it in plain text to anyone with access to Docker. With a _FILE variable, docker inspect only shows a path, and the secret can live in a Docker secret or a tmpfs volume.
The settings that would benefit most:
It might fit in _env() in config.php, roughly like this:
Failing on an unreadable file seems safer than falling back to an empty secret.
For now I work around it with a small entrypoint wrapper that reads the files, exports the variables and then runs docker-php-entrypoint. It works, but it has to repeat the image's start command, so it can break when the image changes.
I'm on 6.156.2. I'm happy to test a build and report back.
Thanks!
All reactions