sops encryption/decryption with age key doesn't work for Python ini Files with [DEFAULT] section
Nobody has claimed this yet.
- 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:
Running sops --encrypt config.ini > config__sops__.ini results in the following file:
Running sops --decrypt config__sops__.ini > config.ini results in the following file:
--> 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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