Skip to content

Built-in sops decryption rejects any file with an empty-string value ("missing ENC prefix"); the sops CLI reads the same file #14800

Closed as not planned

Description

@x45dev

Summary

mise's default decryption path, sops.rops = true, refuses any SOPS file that contains an empty-string value. The sops CLI reads the same file without complaint, so sops.rops = false is the only way to use such a file with mise.

This is not an exotic shape: sops deliberately leaves empty values unencrypted. aes/cipher.go's Encrypt returns early for isEmpty(plaintext), so a key whose value is "" is written to the SOPS file as a bare "" with no ENC[ prefix. rops requires every leaf to start with ENC[ and rejects the whole file.

Any file with a placeholder key - a credential not yet issued, a token blanked out rather than deleted - hits this.

The root cause is already fixed upstream in rops, but the fix has never been released, so mise cannot pick it up with a version bump. See Cause.

Environment

  • Reproduced on mise 2026.9.3, 2026.10.6 and 2026.10.15 (latest release), all linux-x64, in both YAML and JSON.
  • Source checked against v2026.10.15 (597c1897dfed28d1c0dea9f98fba581059e42cd3).
  • Container: debian:stable-slim with the mise binary bind-mounted. Needs network; it installs sops 3.13.3 and age 1.2.1 through mise.

Reproduction

rops-repro.sh:

#!/bin/bash
# Minimal repro: a sops file with one empty-string value.
# The sops CLI reads it; mise's built-in rops decryptor refuses it.
set -u
export HOME=/root MISE_DATA_DIR=/root/.local/share/mise
export PATH=/usr/local/bin:/usr/bin:/bin MISE_YES=1 MISE_MINIMUM_RELEASE_AGE=0
mkdir -p /root/.config/mise /tools /proj

printf '[tools]\nsops = "3.13.3"\nage = "1.2.1"\n' > /root/.config/mise/config.toml
mise install --quiet >/dev/null 2>&1
cp "$(mise which sops)" "$(mise which age-keygen)" /tools/
/tools/age-keygen -o /root/key.txt 2>/dev/null          # throwaway key
PUB=$(sed -n 's/.*public key: //p' /root/key.txt)

# One real secret, one key whose value is the empty string.
printf 'REAL_SECRET: hello\nEMPTY_TOKEN: ""\n' > /tmp/plain.yaml
/tools/sops encrypt --age "$PUB" --input-type yaml --output-type yaml \
  /tmp/plain.yaml > /proj/secrets.yaml
printf '{"REAL_SECRET":"hello","EMPTY_TOKEN":""}\n' > /tmp/plain.json
/tools/sops encrypt --age "$PUB" --input-type json --output-type json \
  /tmp/plain.json > /proj/secrets.json

echo "=== what sops wrote: the empty value is left verbatim, with no ENC prefix ==="
sed -n '1,2p' /proj/secrets.yaml | cut -c1-72

printf '[tools]\nage = "1.2.1"\n' > /root/.config/mise/config.toml
export MISE_SOPS_AGE_KEY_FILE=/root/key.txt
cd /proj
for f in secrets.yaml secrets.json; do
  printf '[env]\n_.file = "%s"\n' "$f" > /proj/mise.toml
  mise trust /proj/mise.toml >/dev/null 2>&1
  for r in true false; do
    echo "--- $f  sops.rops=$r  (mise $(mise --version | head -1)) ---"
    MISE_SOPS_ROPS=$r PATH=/tools:$PATH mise env 2>&1 \
      | grep -vE '^export PATH' | grep -E 'ERROR|^export' | head -5
  done
done

rops-drive.sh:

#!/bin/bash
# usage: ./rops-drive.sh <path-to-mise-binary>
docker run --rm --pids-limit 400 --memory 2g \
  -v "$(readlink -f "$1")":/usr/local/bin/mise:ro -v "$PWD/rops-repro.sh":/r.sh:ro \
  debian:stable-slim bash -c \
  'apt-get update -qq >/dev/null 2>&1; apt-get install -y -qq ca-certificates >/dev/null 2>&1; bash /r.sh'
./rops-drive.sh ./mise-2026.10.15

Results

The file sops writes, with the empty value left verbatim:

REAL_SECRET: ENC[AES256_GCM,data:bqbozMY=,iv:GHmmSfzJFGomf2a2sJ1QWjttEAD...
EMPTY_TOKEN: ""

Identical on all three versions, for both secrets.yaml and secrets.json:

--- secrets.yaml  sops.rops=true ---
mise ERROR failed to decrypt sops file
mise ERROR invalid encrypted map format; unable to parse encrypted value components: missing ENC prefix
mise ERROR unable to parse encrypted value components: missing ENC prefix
mise ERROR missing ENC prefix

--- secrets.yaml  sops.rops=false ---
export EMPTY_TOKEN=''
export REAL_SECRET=hello
mise sops.rops = true sops.rops = false
2026.9.3 missing ENC prefix, YAML and JSON both keys exported
2026.10.6 missing ENC prefix, YAML and JSON both keys exported
2026.10.15 missing ENC prefix, YAML and JSON both keys exported

Secondary: with sops.strict = false the file vanishes silently

sops.strict defaults to true, so the failure above is loud. With strict = false, the same run exports nothing at all - not even REAL_SECRET, which the CLI decrypts fine - and prints no warning:

--- secrets.yaml  sops.rops=true  MISE_SOPS_STRICT=false ---
(no output)

The non-strict branch logs at debug! only, so a config that sets strict = false for an unrelated reason turns this into silently missing environment variables rather than an error.

Cause

Suggested fix

Any of these would do, roughly in order of preference:

  1. Ask gibbz00/rops for a 0.1.8 release carrying bug: fix automatic plugin install on rtx i nodejs@latest #299, then bump the dependency. Cleanest, but it is not mise's to schedule.
  2. Pin the dependency to a git revision past bug: fix automatic plugin install on rtx i nodejs@latest #299 until a release exists.
  3. Fall back to the sops CLI when rops fails to parse a file, rather than failing. The CLI is already implemented in the same function for sops.rops = false, so this is a fallback rather than new code. That also covers whatever other rops/sops format divergences remain.
  4. At minimum, make the non-strict path warn rather than debug! when decryption fails, and say in the sops.rops setting docs that empty values need sops.rops = false. This one is worth doing regardless of 1-3, since silently dropping secrets is the worst of the outcomes above.

Related


AI disclosure: an AI agent (Claude Code) investigated this and wrote this report. The container runs above are its own output on an x86-64 Linux host, and the source, crates.io and rops references were checked against the commits and endpoints cited.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions