Skip to content

Docs: full .sops.yaml spec & dotenv examples / troubleshooting #1818

Description

@tj-smith47

I've seen a number of issues over the years about problems with dotenv files not encrypting properly. Some were user error, but some I can reproduce. I'm trying to take a repo containing unencrypted files using file extensions .yml, .json, .env, and .conf, and am passing them through sops to an encrypted variant of the repo (so I'm not using the in place flag, nor am I renaming any files / adding .enc). With the exception of .env, all of these are properly encrypted.

As an example, using a file named project/base/project.env containing 4 lines of KEY=val and passing it through sops -e [unencrypted_file] > [encrypted_file] results in 4 unencrypted lines atop the file. I've also tried many different combinations of --input-type [dotenv|binary] and/or --output-type [dotenv|binary]. The closest I've gotten is that it combines all lines in a single data key with \n joining the lines on decryption.

I imagine the reason I'm struggling with this (and many others have in the past as well) is due to the lack of explicit examples / FAQ around dotenv files, in combination with a lack of a full .sops.yaml spec outlining all supported values. Initially I had set a creation rule regex of ^(string|stringData)$, but removing that still results in gitleaks flagging the unencrypted values.

I (and I'm sure many others) would immensely appreciate a dedicated section around the nuances of working with dotenvs, what to check when they're not encrypted properly, and a full .sops.yaml spec being published. In the meantime however, if you're familiar with the cause of my issue and have a solution you could recommend, that would be very helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions