getsops / getsops/sops

DOTENV multi-line vars with double quotes are converted

Open
#724 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
23.1k
Forks
1.1k
Avg merge
1d 11h
Merged PRs (30d)
9

Description

In some cases when using DOTENV where a private key is required as an environment variable the only way to make it work is to provide the var in a very specific format (this is commonly found when working with firebase in node/react):

FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nzzzzzzzz\n-----END PRIVATE KEY-----\n"

If you encrypt a file containing a value like the above SOPS converts it to:

FIREBASE_PRIVATE_KEY='
-----BEGIN PRIVATE KEY-----
zzzzzzzz
-----END PRIVATE KEY-----
'
This breaks the format and services using that var will refuse to start because of invalid PEM format.

If the var is entered the same but with single quotes:

FIREBASE_PRIVATE_KEY='-----BEGIN PRIVATE KEY-----\nzzzzzzzz\n-----END PRIVATE KEY-----\n'

SOPS does not convert it to a multi-line variable but it also retains the single quotes, and the var won't work unless it is double quoted.

The values are retained exactly if binary format is used instead of DOTENV, however when doing so the plain text keys are lost so it is no longer possible to view the keys when viewing the encrypted file (lose all the benefits).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the DOTENV examples in the report, including double-quoted escaped newlines and single-quoted values. Trace the DOTENV serialization path and compare its output with the expected escaped form; done means private-key values retain valid PEM formatting and existing DOTENV behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.