getsops / sops

Simple and flexible tool for managing secrets
https://getsops.io/
Mozilla Public License 2.0
16.32k stars 858 forks source link

Error dumping file: Error marshaling to yaml: yaml: expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got document end #926

Open Morriz opened 3 years ago

Morriz commented 3 years ago

Hi, it seems that it is possible to encrypt an empty yaml file, but then not decrypt it. It then results in this error:

Error dumping file: Error marshaling to yaml: yaml: expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got document end

Example content of such a file (as you can see this is on azure):

sops:
    kms: []
    gcp_kms: []
    azure_kv:
        - vault_url: https://xxxxxxxxx.vault.azure.net
          name: otomi-key
          version: 0fb75d551be64ae3b9411014e50e925b
          created_at: "2021-08-30T20:12:20Z"
          enc: xFtl_cLwDaKEdfO3QYQbLmrjb3RY5EchBZiF8NlKJPbTD1xQY4PTkCnbUsaloVZgQD_vHLcW9DVuy1hoBpVDYWJzelX3fIGAQMOpa8Y5k2qWjPfyyGxEkLG3Z6wSGX2ryZMf2liZZK-VumhPzEnZS5lFyRZs62MEDnV23_dd2lpGQrazC3qebsxzZGHn2_HwlyJKVr6fNyL3s1qhJ1mdBKZLDKSimPjq4R16CPoRBgjCWEXwjtJVpxzixXS6NWiRC6Zt__JmVNAwN1MAq8z8myBm9MbBULmYi0AhH-QG4U2jJoqRjxdsUWLzUhianFxxOsAtON8MFIXpb8oYbx0s2g
    hc_vault: []
    age: []
    lastmodified: "2021-08-30T20:12:21Z"
    mac: ENC[AES256_GCM,data:/DJmH2x/s+FfLu0LcdQJntDilgqn3LXH09RvoKzjBZz+MY/q+OMefEqwNDt9jD4KHlx5HsyUWvZtrPzyvgEdM8eTW4ZSDukPJC5nYs/Fh72NE5vuWZYuMsEP6IdylMmttR/GDvRPz9awptewQKHfqbZOEj8sPXE+ktLiXunVdEg=,iv:iC8YAir5O/vEqFZMC93WHNFaMlpCtrrD6NbRdtn4ozY=,tag:C2RygMzUh403RvB9PtTcmA==,type:str]
    pgp: []
    unencrypted_suffix: _unencrypted
    version: 3.7.1
felixfontein commented 3 years ago

Duplicate of #907, and will be fixed by #908.

Morriz commented 3 years ago

Ah, so #908 will just skip empty yaml files? I can close this one here then...