Force state change if encryption used fallback (#2232)

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
Christian Mesh
2024-12-03 17:44:30 -05:00
committed by GitHub
parent 8fb8f066c4
commit c7aaa5ed50
12 changed files with 82 additions and 27 deletions

View File

@@ -60,13 +60,14 @@ func (p planEncryption) EncryptPlan(data []byte) ([]byte, error) {
}
func (p planEncryption) DecryptPlan(data []byte) ([]byte, error) {
return p.base.decrypt(data, func(data []byte) error {
data, _, err := p.base.decrypt(data, func(data []byte) error {
// Check magic bytes
if len(data) < 2 || string(data[:2]) != "PK" {
return fmt.Errorf("Invalid plan file %v", string(data[:2]))
}
return nil
})
return data, err
}
func PlanEncryptionDisabled() PlanEncryption {