-
Notifications
You must be signed in to change notification settings - Fork 899
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
Added a way to ignore MAC validation to the decrypt package #758
Conversation
Why do you want this? Ignoring MAC validation is rarely a good idea. Without getting into the implementation, I would prefer not supporting this unless you have a good use case, since it's dangerous. |
Without going into too much technical details, our encrypted Json goes through an Unmarshal/Marshal step before we can decrypt it. Since this step changes the fields ordering, the original Json and pre-decrypt one will be different causing a validation error. I understand that this validation pass is the default and that it should stay that way. But, with that said, my use case is still there and, I think that by duplicating a feature that is already provided in the CLI with the |
While I do agree that in nearly all cases we should have feature parity between the cli and the library, I do agree with @autrilla. In my mind, using Nonetheless, if you feel comfortable ignoring the MAC for your use case, so be it, but I don't think we should support this within the library. |
Thank you, I'm closing the PR. |
I can't see a strong reason to have a different interface between CLI and the library. If the option should not be used or if it is dangerous then the CLI probably also shouldn't have the option, but it does. I think the reason the option exists is because there are valid use cases for when Basically the option is useful in any situation when the encrypted data object might be changed by another tool, and where the encrypted data is not affected. For my use case, I am looking at Kubernetes objects that store encrypted data. Kubernetes manages the data object, and as such, adds and mutates parts of the data to achieve its goals. This obviously doesn't play well with the MAC validation. I don't think it makes sense that the only way to skip the MAC validation is to either use the CLI or to write your own version of the decrypt package that implements an existing feature of the CLI. |
You're not wrong. If someone came today and asked for
But it is affected. Maybe not for the semantics you want, but the file is affected, otherwise the MAC would still be valid. Without going very far into it, I think the approach of such an operator is wrong. Giving Kubernetes a SOPS file directly is bound to be very brittle. |
Fair enough. I understand that you don't want to add this option to the library as a way to compel library users to adhere to the integrity constraints that the MAC provides. I can see the benefits of the MAC, let me see if there is a way I can use this library and keep the MAC intact. Cheers |
The CLI provides a way to skip MAC validation which was not mirrored to the decrypt package.
Simply adding a way to duplicate what can be done using the sops CLI with the --ignore-mac flag.