зеркало из https://github.com/getsops/sops.git
Added warning message whenever a file without a MAC is found.
This commit is contained in:
Родитель
3cdf659887
Коммит
dd0a890e86
7
sops.go
7
sops.go
|
@ -472,7 +472,12 @@ func ToBytes(in interface{}) ([]byte, error) {
|
||||||
// MapToMetadata tries to convert a map[string]interface{} obtained from an encrypted file into a Metadata struct.
|
// MapToMetadata tries to convert a map[string]interface{} obtained from an encrypted file into a Metadata struct.
|
||||||
func MapToMetadata(data map[string]interface{}) (Metadata, error) {
|
func MapToMetadata(data map[string]interface{}) (Metadata, error) {
|
||||||
var metadata Metadata
|
var metadata Metadata
|
||||||
metadata.MessageAuthenticationCode, _ = data["mac"].(string)
|
mac, ok := data["mac"].(string)
|
||||||
|
if !ok {
|
||||||
|
fmt.Println("WARNING: no MAC was found on the input file." +
|
||||||
|
"Verification will fail. You can use --ignore-mac to skip verification.")
|
||||||
|
}
|
||||||
|
metadata.MessageAuthenticationCode = mac
|
||||||
lastModified, err := time.Parse(time.RFC3339, data["lastmodified"].(string))
|
lastModified, err := time.Parse(time.RFC3339, data["lastmodified"].(string))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return metadata, fmt.Errorf("Could not parse last modified date: %s", err)
|
return metadata, fmt.Errorf("Could not parse last modified date: %s", err)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче