getsops / getsops/sops

sops encryption/decryption with age key doesn't work for Python ini Files with [DEFAULT] section

Open
#1,451 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/keyservice area/stores bug stores/ini
Dominant language
Go
Stars
23.1k
Forks
1.1k
Avg merge
1d 11h
Merged PRs (30d)
9

Description

I have the following config.ini File for a Python project:

image

Running sops --encrypt config.ini > config__sops__.ini results in the following file:

image

Running sops --decrypt config__sops__.ini > config.ini results in the following file:

image

--> The [DEFAULT] section is stripped.

The [DEFAULT] section is very important for the Python configparser (https://docs.python.org/3/library/configparser.html#module-configparser). When it's missing, the configparser can't read the config file.

After decrypting and encrypting the config.ini, Python can't read the config.ini anymore.

When I rename the [DEFAULT] section name in config.ini File to [default] (or any other name), then sops works as expected (but Python won't work anymore).
It seems, that the [DEFAULT] section (with capital letters) is somehow reserved for sops???

A possible workaround for me is to define the "default" section in the Python code with setting the default_section property when initializing the configparser.

Please fix this issue.

Thanks in advance
TheRaspyDev

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 report with a config.ini containing a capitalized [DEFAULT] section, then run the shown sops --encrypt and sops --decrypt commands. Inspect the INI parsing and serialization path used by sops. Done means the [DEFAULT] section survives the encryption/decryption round trip and Python configparser can read the resulting file.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.