New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sops encryption/decryption with age key doesn't work for Python ini Files with [DEFAULT] section #1451
Comments
It seems that the problem is that the INI library used by SOPS uses |
(The name |
Thanks for the fast reply. I always thought, that INI File is a "standard". But it seems that (at least) Python works different. In Python, a "default" section is mandatory (the .ini file has to start with a section header). Otherwise the The workaround (define a custom default_section) is fine for me at the moment: I'm looking forward whether a solution can be found for this bug. |
Unfortunately no, there are thousands of similar, but sometimes incompatible ways that applications deal with INI files... |
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
The text was updated successfully, but these errors were encountered: