Describe the Bug
Creating a new OIDC client via the command line tries to turn the client name into an environment variable. If the name contains a hyphen, this name is turned into a variable name with a hyphen similar to this: TINYAUTH_OIDC_CLIENTS_MY-APP_CLIENTID.
When the variable is placed in a file and loaded via systemds EnvironmentFile=, lines with variable names containing hyphens are ignored: https://man7.org/linux/man-pages/man5/systemd.exec.5.html#ENVIRONMENT
Disallowing hyphens would fix that issue.
How to Reproduce
- Run
./tinyauth oidc create my-app
- It displays the environment variable
TINYAUTH_OIDC_CLIENTS_MY-APP_CLIENTID
- When running
tinyauth via systemd, this variable is ignored and OIDC does not work.
Expected Behavior
It should display an error, because an environment variable with a dash is invalid in systemd.
Additional Context
The variables are ignored when they contain a hyphen:
root@tinyauth:~# cat /opt/tinyauth/.env
TINYAUTH_DATABASE_PATH=/opt/tinyauth/database.db
TINYAUTH_AUTH_USERS='foo@example.com:$$2a$$10$$redacted123'
TINYAUTH_APPURL=https://auth.example.com
TINYAUTH_OIDC_CLIENTS_MY-APP_CLIENTID=foo
TINYAUTH_OIDC_CLIENTS_MY-APP_CLIENTSECRET=bar
TINYAUTH_OIDC_CLIENTS_MY-APP_NAME=baz
root@tinyauth:~# systemd-run --wait --pipe -p EnvironmentFile=/opt/tinyauth/.env /usr/bin/env | grep -o '^TINYAUTH_[^=]*'
Running as unit: run-p847-i2375553.service; invocation ID: 8bb8043490f3415a8ba4744f5cad4918
TINYAUTH_DATABASE_PATH
TINYAUTH_AUTH_USERS
TINYAUTH_APPURL
Finished with result: success
But are kept when they don't:
root@tinyauth:~# cat /opt/tinyauth/.env
TINYAUTH_DATABASE_PATH=/opt/tinyauth/database.db
TINYAUTH_AUTH_USERS='foo@example.com:$$2a$$10$$redacted123'
TINYAUTH_APPURL=https://auth.example.com
TINYAUTH_OIDC_CLIENTS_MYAPP_CLIENTID=foo
TINYAUTH_OIDC_CLIENTS_MYAPP_CLIENTSECRET=bar
TINYAUTH_OIDC_CLIENTS_MYAPP_NAME=baz
root@tinyauth:~# systemd-run --wait --pipe -p EnvironmentFile=/opt/tinyauth/.env /usr/bin/env | grep -o '^TINYAUTH_[^=]*'
Running as unit: run-p854-i2400855.service; invocation ID: de43d415f7234abcbb7c6cf87057f311
TINYAUTH_DATABASE_PATH
TINYAUTH_AUTH_USERS
TINYAUTH_APPURL
TINYAUTH_OIDC_CLIENTS_MYAPP_CLIENTID
TINYAUTH_OIDC_CLIENTS_MYAPP_CLIENTSECRET
TINYAUTH_OIDC_CLIENTS_MYAPP_NAME
Finished with result: success
Logs
No response
Operating System
Linux
Browser
No response
Tinyauth Version
v5.2.0
Docker Version (if applicable)
No response
Human Written Confirmation
Describe the Bug
Creating a new OIDC client via the command line tries to turn the client name into an environment variable. If the name contains a hyphen, this name is turned into a variable name with a hyphen similar to this:
TINYAUTH_OIDC_CLIENTS_MY-APP_CLIENTID.When the variable is placed in a file and loaded via
systemdsEnvironmentFile=, lines with variable names containing hyphens are ignored: https://man7.org/linux/man-pages/man5/systemd.exec.5.html#ENVIRONMENTDisallowing hyphens would fix that issue.
How to Reproduce
./tinyauth oidc create my-appTINYAUTH_OIDC_CLIENTS_MY-APP_CLIENTIDtinyauthviasystemd, this variable is ignored and OIDC does not work.Expected Behavior
It should display an error, because an environment variable with a dash is invalid in systemd.
Additional Context
The variables are ignored when they contain a hyphen:
But are kept when they don't:
Logs
No response
Operating System
Linux
Browser
No response
Tinyauth Version
v5.2.0
Docker Version (if applicable)
No response
Human Written Confirmation