Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressing encrypted files should not be done. #377

Closed
jonathan-s opened this issue Dec 13, 2020 · 3 comments
Closed

Compressing encrypted files should not be done. #377

jonathan-s opened this issue Dec 13, 2020 · 3 comments
Milestone

Comments

@jonathan-s
Copy link
Contributor

jonathan-s commented Dec 13, 2020

Bug Report

Describe the bug

As mentioned in this server fault post you can't compress encrypted files which is what we try to do if use both the compression flag and the encryption flag.

See https://github.com/django-dbbackup/django-dbbackup/blob/master/dbbackup/management/commands/dbbackup.py#L81-L86

Expected behavior

Either or needs to be selected, if both are selected we should throw an error so that the user can take a correct decision. Alternatively, which may be a better decision is that we need to compress first, then do an encryption as mentioned here in #292

Versions

Django-dbbackup

  • pypi: 3.3.0
@jonathan-s jonathan-s changed the title Compressing encrypted files should not be possible. Compressing encrypted files should not be done. Dec 13, 2020
@jonathan-s jonathan-s added this to the 3.4.0 milestone Dec 13, 2020
@johnthagen
Copy link
Contributor

If you compress first, and then encrypt you should be able to have the benefits of both.

@johnthagen
Copy link
Contributor

johnthagen commented Dec 21, 2020

Looking at the code, it looks like this is done in the correct order (compression first, to reduce size, and then encrypt).

        if self.compress:
            compressed_file, filename = utils.compress_file(outputfile, filename)
            outputfile = compressed_file
        if self.encrypt:
            encrypted_file, filename = utils.encrypt_file(outputfile, filename)
            outputfile = encrypted_file

@ZuluPro
Copy link
Contributor

ZuluPro commented Dec 25, 2020

@jonathan-s @johnthagen
Yes I compress, then encrypt, no issue

@ZuluPro ZuluPro closed this as completed Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants