-
Notifications
You must be signed in to change notification settings - Fork 243
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
Change vault to use GCM with counter #178
Conversation
Codecov Report
@@ Coverage Diff @@
## master #178 +/- ##
==========================================
+ Coverage 66.97% 66.98% +<.01%
==========================================
Files 35 36 +1
Lines 2695 2732 +37
==========================================
+ Hits 1805 1830 +25
- Misses 659 665 +6
- Partials 231 237 +6
Continue to review full report at Codecov.
|
@Skarlso don't forget to initialize the counter if the file exists in init. Otherwise the counter will be overwritten by a save that was not preceeded by a load. That is technically not possible right now from the Frontend but you never know... 🙂 |
Actually it doesn't matter. Since the vault is always overwritten. If anyone does a save accidentally before loading in all the secrets, they will basically wipe the vault with what they have in the data. This is by design because the vault is never stored unencrypted. |
Cool. Thanks a lot @Skarlso |
Oh! That's a very good notion. It will, yes. :/ Crap. I need to come up with a fallback to cycle out the old vault files. And after a while delete it. |
I guess a migration step would be helpful here. So when Gaia is about to start, we check if the existing vault is in an old state and migrate it to the new state? |
@michelvocks correct, that's my vision. It should be fairly easy to check since the new one is in a different format. If hex.Decode fails, I'll try with the previous method. If that works, I'm loading it in and converting it back to the new format. After a while, we can delete that functionality. |
This is not true. I hashed the whole thing. |
Hopefully after everyone has taken the new version this will be much improved and the old vault files will be replaced. :) |
Huh, okay, it's not that bad. This was a password for example ( this is a dummy one ):
So I think we are fine.. :D |
Alright. This is now working with the fall back too. I tested it with an old encrypted vault and a new one. The old one was overwritten and replaced with a new vault file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 😄 One small minor issue
security/vault.go
Outdated
@@ -82,8 +87,15 @@ func NewVault(ca CAAPI, storer VaultStorer) (*Vault, error) { | |||
if err != nil { | |||
return nil, err | |||
} | |||
if len(data) < 32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can use keySize
here?
I need to increase the coverage a bit.
Overall though... it works. :)