bbtsoftware / docker-mssql-backup

Docker image for periodic backups from a Microsoft SQL Server container
MIT License
29 stars 19 forks source link

Bug: setting a password containing either `$` or `@` will not login #44

Open briosheje opened 3 years ago

briosheje commented 3 years ago

First of all, thanks for the amazing work done with the image.

Abstract

The problem encountered is that if a password with either @ or $ or both is provided, the login will always fail because the password is not escaped.

How to reproduce

Setup a docker-compose with a service like this one (and, of course, an mssql instance):

mssql-backup:
    image: bbtsoftwareag/mssql-backup
    container_name: mssql-backup
    environment:
      - TZ=Europe/Rome
      - BACKUP_CLEANUP=true
      - BACKUP_AGE=${BACKUP_AGE}
      - DB_SERVER=someserver
      - DB_USER=SA
      - DB_PASSWORD=${DATABASE_PASSWORD}
      - "DB_NAMES=
          Somedatabase"
      - CRON_SCHEDULE=${DATABASE_BACKUP_CRON}
    volumes:
      - ${DATABASE_BACKUP_MOUNT_PATH}:/backup
    networks:
      - somenetwork

Create a .env file with the following content:

DATABASE_PASSWORD=XanAm@zing$password
DATABASE_BACKUP_CRON=*/30 5-20 * * 1-6
DATABASE_BACKUP_MOUNT_PATH=./database-backups
BACKUP_AGE=180

Run compose up: the backup will fail with error "Login failed for user ".

The solutions are either to don't use @ and $ in a password, either escape them in some way

christianbumann commented 3 years ago

Hi @briosheje

Thank you for reporting this issue. We will fix this as soon as possible.