[SOLVED] Special characters in SMTP password set in "vaultwarden.env" file get ignored #1115

Closed
opened 2025-11-07 06:58:13 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @TheHellSite on GitHub (Sep 23, 2021).

Subject of the issue

My SMTP password contains special characters (f.e. ~^",.%\,'}&@|/(#}) which seem to be an issue for Vaultwarden if it is reading the password from the vaultwarden.env file.
If I set it through the admin panel it works just fine but doesn't get saved to vaultwarden.env file.

Deployment environment

  • Proxmox Arch Linux LXC

  • vaultwarden version: 1.22.2

  • Install method: OS package

Steps to reproduce

Use an SMTP password that contains \ as a character.
I don't know if " and ' are also causing some trouble?

INPUT vaultwarden.env: ~^",.%\,'}&@|/(#}
OUTPUT admin panel:    ~^",.%,'}&@|/(#}
Replaced characters:   \

Expected behaviour

\ character should get recognized in the password field when set using the vaultwarden.env file.

Actual behaviour

\ character is ignored or replaced with no character at all.

Originally created by @TheHellSite on GitHub (Sep 23, 2021). ### Subject of the issue My SMTP password contains special characters (f.e. ``~^",.%\,'}&@|/(#}``) which seem to be an issue for Vaultwarden if it is reading the password from the ``vaultwarden.env`` file. If I set it through the admin panel it works just fine but doesn't get saved to ``vaultwarden.env`` file. ### Deployment environment * Proxmox Arch Linux LXC * vaultwarden version: 1.22.2 * Install method: OS package ### Steps to reproduce Use an SMTP password that contains ``\`` as a character. I don't know if ``"`` and ``'`` are also causing some trouble? ``` INPUT vaultwarden.env: ~^",.%\,'}&@|/(#} OUTPUT admin panel: ~^",.%,'}&@|/(#} Replaced characters: \ ``` ### Expected behaviour ``\`` character should get recognized in the password field when set using the vaultwarden.env file. ### Actual behaviour ``\`` character is ignored or replaced with no character at all.
Author
Owner

@BlackDex commented on GitHub (Sep 23, 2021):

A \ is an escape parameter. If you want to use that you need to type \\.
Also, Quotes, no matter if they are double or single could be needed to be escaped also.
It could depend on which type of env parsing there is used, but if you want the password you provided above you need to enter it like this for at least docker run, docker-compose or using the .env file:
"~^\",.%\\,'}&@|/(#}"

  1. It is enclosed within double quotes "
  2. The " of the password is escaped via \"
  3. The \ of the password is escaped via \\
@BlackDex commented on GitHub (Sep 23, 2021): A `\` is an escape parameter. If you want to use that you need to type `\\`. Also, Quotes, no matter if they are double or single could be needed to be escaped also. It could depend on which type of env parsing there is used, but if you want the password you provided above you need to enter it like this for at least `docker run`, `docker-compose` or using the `.env` file: `"~^\",.%\\,'}&@|/(#}"` 1. It is enclosed within double quotes `"` 2. The `"` of the password is escaped via `\"` 3. The `\` of the password is escaped via `\\`
Author
Owner

@TheHellSite commented on GitHub (Sep 23, 2021):

Thanks, that explained and solved it!
I only had to escape \ using \\.

@TheHellSite commented on GitHub (Sep 23, 2021): Thanks, that explained and solved it! I only had to escape ``\`` using ``\\``.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vaultwarden#1115