`sops` rewrites YAML tree containing references
Something like:
a: &a something
b: *a
Will rewrite the file without references to:
a: something
b: something
I think the parser does this, but is there a way to turn that off?
You can't use YAML references in sops, because we calculate a MAC on the entire tree. If you want to treat this as a string, you could protect it with quotes.
References are not strings but they are part of the non-key portions in a YAML. I may be missing something, but why can't the MAC be calculated on the whole tree, even without dereferencing?
I'm reopening this because, now that I think of it, I wonder if we could work around the parser to make this work. @autrilla : what do you think?
MAC computation would require either dereferencing, or some sort of special case. In the end, we're hashing bytes for the MAC, so as an example we could just have anchors hashed as "reference to X", but then we'd have to protect against the reference being replaced by just "reference to X", so imo we should dereference.
Dereferencing while keeping the anchor in the output document would probably require some serious modification to go-yaml, which I don't expect would ever be merged. And at this point, maybe we should consider operating at the YAML token level instead of at the data level.
Closing as there are no plans to make this work. If anything, a PR would have to be filed against go-yaml to add this functionality. Once that is done, support for it in SOPS could be considered.