Skip to content

Conversation

@kira-bruneau
Copy link

@kira-bruneau kira-bruneau commented Jul 23, 2024

Fixes #470.

Previously, encryption errors from unmarshalFile were grouped together with vault load errors as "corrupt vault" errors, and https://github.com/kira-bruneau/proton-bridge/blob/2fd0985a523784ec412de68ec5bec5bf4309e485/internal/vault/vault.go#L370-L377 would reset the vault any time it was found to be "corrupt".

This change just checks if the resulting error is an encryption error first, and if it is, wires it up like any other I/O error.

Before:

WARN[Jul 23 21:13:10.396] Failed to load existing vault, vault has been reset  error="failed to decrypt vault: cipher: message authentication failed"
WARN[Jul 23 21:13:10.414] The vault is corrupt and has been wiped

After:

FATA[Jul 24 10:18:22.188] could not load/create vault: failed to decrypt vault: cipher: message authentication failed

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

Successfully merging this pull request may close these issues.

Vault gets wiped on startup when using pass

1 participant