Skip to content
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

sops creates yaml file with tab indentation #434

Closed
jcassee opened this issue Mar 4, 2019 · 4 comments
Closed

sops creates yaml file with tab indentation #434

jcassee opened this issue Mar 4, 2019 · 4 comments

Comments

@jcassee
Copy link
Contributor

jcassee commented Mar 4, 2019

After encrypting a file using sops -e, the resulting yaml file was indented using tabs. This is disallowed by the spec and does not pass yaml linters. After manually converting the tabs to spaces sops -d continues to work, so this is mostly an inconvenience.

@autrilla
Copy link
Contributor

autrilla commented Mar 4, 2019

I can't reproduce this:

(prod)autrilla@iron:/tmp# sops --version
sops 3.2.0 (latest)
(prod)autrilla@iron:/tmp# echo 'hello: world' > foo.yaml
(prod)autrilla@iron:/tmp# sops -e --pgp EFB85AB35C06836B5BF58B1B694DD67D01067045 foo.yaml | tr " " "*" | tr "\t" "&"
hello:*ENC[AES256_GCM,data:HHXuVJw=,iv:uZYaBhs1oyM5KnM+D7Met7EKb49hGBAC+gi0WDrObpU=,tag:2lp8lRY85KyzUhnDhe7S2A==,type:str]
sops:
****kms:*[]
****gcp_kms:*[]
****azure_kv:*[]
****lastmodified:*'2019-03-04T15:33:27Z'
****mac:*ENC[AES256_GCM,data:HrNveD3kalcoHMLbJtqT0+iwyRqfI9jeZ2CeWJctuFetbAd2JWdNSJ/8EtaK0VQ8AmneLIwAqmzfzeVDYgIndeXjEVUpAHPEhdYcXBEQxZndT6WS6GWNCCTu8iXnByYI/sByz1boxqr0gRtDsbrYo2TvfHed5+X3NBdvJQkkW6c=,iv:0qViwLcmnnir3A2htUuxsyZwJPZNV9uOpXCu1YK7MGQ=,tag:AY5esD46BHeos5I/80GH2Q==,type:str]
****pgp:
****-***created_at:*'2019-03-04T15:33:27Z'
********enc:*|-
************-----BEGIN*PGP*MESSAGE-----

************wcBMA6k2PkgIMastAQgAPETsexcI3HqMVq0nGzSFivMsGPnFY08K0ooqbQb632ao
************tAjs0rwelZYkOvmm2Dz40GoimAd4ZIp2EmFxLt7Soi5sXt20sqAaWDcmMZo05Mk0
************fgzdch21JeKWxJe5M6FXwdQ2oURBe/ZBPj2FjnVMKGipFztUBUW4RUxD5QCTuRtm
************Vof50wAAWHruw+U2mgKwYE6gyOWQ9YuQziL+tbfU/2PU17OmVaxluUf1Og7YPerc
************oIcD7jrBn10JBJqxTfynl8J7jbe/w429ptvfDbUCYwpoCQvpHwLluggwU/9LWwZI
************BZK1ZODOqP0sk2lNpnsNpHnAUlaW+UfXxweHMK3gANLgAeRfcSeHqz+SNjea873g
************k/oX4WVQ4KDgbuEpl+BC4gVhj/LgxeUgJSHDBqIU+EPfdge3KlRV7GaUkyJfmtiD
************4EoK2xlXvuAH5OUPm6LvR7y0zACtXTU8UR/iGMQEjeERQwA=
************=xwLR
************-----END*PGP*MESSAGE-----
********fp:*EFB85AB35C06836B5BF58B1B694DD67D01067045
****unencrypted_suffix:*_unencrypted
****version:*3.2.0

@jcassee
Copy link
Contributor Author

jcassee commented Mar 4, 2019

@autrilla Could you try with a "binary" file, such as the sops README.rst?

@autrilla
Copy link
Contributor

autrilla commented Mar 4, 2019

Sure:

autrilla@iron:/tmp# sops -e --pgp EFB85AB35C06836B5BF58B1B694DD67D01067045 binary | tr " " "*" | tr "\t" "&"
{
&"data":*"ENC[AES256_GCM,data:O7LjMP4ocw==,iv:IgGMkU4wcfF2FGkrfS78tHa5Gy7Jl+pSCZHZFB+h5Oc=,tag:8uWpiqNtm9FWHbSdeWLvHw==,type:str]",
&"sops":*{
&&"kms":*null,
&&"gcp_kms":*null,
&&"azure_kv":*null,
&&"lastmodified":*"2019-03-04T16:13:08Z",
&&"mac":*"ENC[AES256_GCM,data:fWI0ydFjDforz9zoTCVkji5bIeL6zZaQs8j2ryE99QeQlKjzaC/32IjgwrEyPv1ujQELePJyxeGOTUkszTXuUWlKrWjDCsSd7/FMAdOJ3KgcR1bAxKLy5WfyGHO7EGpLDiwRJpD8mi46cMdtkwN4RksorisywGMKTfY70gME9Zw=,iv:ch4c9EP8fmSbW2IioVSoyXdvcB07X7FHMb3WW4Mghgs=,tag:g/KJ73dAAcPmXmxREBKqog==,type:str]",
&&"pgp":*[
&&&{
&&&&"created_at":*"2019-03-04T16:13:07Z",
&&&&"enc":*"-----BEGIN*PGP*MESSAGE-----\n\nwcBMA6k2PkgIMastAQgAG0X2Lr74UKqGNWYO/4CxQIEymeOhHTgY34Yuncsc5Mhr\nYQS2JKiXzWwmMuHU3swOdIHs9/0fobMPIVGkU1RW6xNc5wUDTIhxMENqLtzQU6G8\n5umsANUXwsybryp9GhACjqlvKffmQwrGSbjo9JXNMWA7kN/H0CpZIJ4s3j/nuDvt\n8IKFSTRrFDCU+E5mXt3C9KVxkTAWW7xYAPW1T7LsoElIs95US7qrAHnD94PjoJKA\nIgaT11II9gXjRLH3v1lKWLNhRJ6uRAVOluT7DG1fT1eLX4LLSfyF6Tfnw8m3oU3G\nWA7yBHWiddm9X9TKlzYycXdG9whz8WmAQHQUFUqnTtLgAeTzGG6t6m71iAcu7qg9\nvH0t4dXH4LDg3uF6BeCY4mq1hRrgXeWBBk73UQHVjsh16I1uvXTVpy0hdIxCV+6B\nOi8seRPwC+AI5LTmMTMfSXybMpk5ifm+jevi598hnuHCJwA=\n=pzLP\n-----END*PGP*MESSAGE-----",
&&&&"fp":*"EFB85AB35C06836B5BF58B1B694DD67D01067045"
&&&}
&&],
&&"unencrypted_suffix":*"_unencrypted",
&&"version":*"3.2.0"
&}
}%

Binary files are JSON, not YAML.

@jcassee
Copy link
Contributor Author

jcassee commented Mar 4, 2019

Argh, thanks! Of course, most JSON is valid YAML, so when I named it xxxx.sops.yaml it was interpreted as yaml by my linter. Thanks for clearing my eyes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants