Skip to content

GDrive: add optional encryption checkbox for backup files#5342

Open
altoch wants to merge 1 commit intoopnsense:masterfrom
altoch:master
Open

GDrive: add optional encryption checkbox for backup files#5342
altoch wants to merge 1 commit intoopnsense:masterfrom
altoch:master

Conversation

@altoch
Copy link
Copy Markdown

@altoch altoch commented Mar 21, 2026

Important notices
Before you submit a pull request, we ask you kindly to acknowledge the following:

  • I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
  • I opened an issue first for non-trivial changes and linked it below.
  • AI tools were used to create at least part of the code submitted herewith.
    If AI was used, please disclose:
  • Model used: Claude (Anthropic)
  • Extent of AI involvement: Used to assist in debugging and drafting the PR description. The fix was identified and tested manually on a real OPNsense 26.1.4 (amd64) installation.

Related issue
No issue opened. The change is self-contained and the problem is described below.


Describe the problem
When the Password field is left empty in the Google Drive backup settings, encrypt() fails silently because OpenSSL receives an empty password file. As a result, encrypt() returns null, which is passed directly to $client->upload(). The file is created on Google Drive with 0 bytes, and the UI still reports "Backup successful" with no indication of failure.

Additionally, encryption should be opt-in. There are valid use cases where a user may not want to encrypt backups (e.g. private Shared Drives with restricted access), and forcing encryption without a clear UI option is inconsistent with the rest of the backup UI (Download and Restore sections already use an explicit encrypt/decrypt checkbox).


Describe the proposed solution
Added an optional "Encrypt backup files" checkbox to the Google Drive backup configuration, consistent with the existing Download and Restore UI patterns.

  • If the checkbox is unchecked: the configuration is uploaded in plaintext. No password required.
  • If the checkbox is checked and a password is provided: the configuration is encrypted before upload.
  • If the checkbox is checked but no password is provided: encryption fails, the backup is aborted, and an error is logged. No 0-byte file is uploaded.

The comparison logic when checking for duplicate backups also respects the encryption setting, decrypting the previous backup only when encryption is enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant