DaPutzy / intellij-sops-plugin

Simple Sops Edit
https://plugins.jetbrains.com/plugin/21317-simple-sops-edit
MIT License
11 stars 3 forks source link

secrets.yaml not detected as SOPS file (again) #10

Closed plevart closed 1 year ago

plevart commented 1 year ago

Hi,

I'm using sops to encrypt secrets.yaml file used when specifying values for helmfile releases. I'm using sops command line directly to edit encrypted files like this:

EDITOR=kwrite sops /path/to/secrets.yaml

...and this works. But since I'm using IDEA to edit other files, I wanted to try this plugin. It doesn't detect the secrets.yaml file to be SOPS encrypted file and doesn't show the status line with a link to "Edit" it in decrypted form. The encrypted file structure does contain the following at the end:

sops:
    kms: []
    gcp_kms: []
    azure_kv: []
    hc_vault: []
    age: []
    lastmodified: "2023-07-07T14:22:35Z"
    mac: ENC[...redacted...]
    pgp:
        - created_at: "2023-06-13T15:47:51Z"
          enc: |-
            -----BEGIN PGP MESSAGE-----
               ...redacted...
            -----END PGP MESSAGE-----
          fp: ...redacted...
    unencrypted_suffix: _unencrypted
    version: 3.7.3

Somewhere I read that users put a .sops.yaml file in the project's root folder. I don't have such file. I added an empty .sops.yaml file into project's root folder and the plugin then recognized the SOPS encrypted file and allowed me to start editing it in decrypted form. But when saving the modified decrypted tab and upon closing it, I get the following error and original file is left intact:

Sops error
config file not found and no keys provided through command line options

Should I put some content into .sops.yaml file in the project's root and what? I didn't need that file for editing encrypted files using sops command line directly.

plevart commented 1 year ago

After wrestling for a while with ChatGPT which persistently tried to convince me to use something like this:

creation_rules:
  - path_regex: '.*'
    kms: arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012

...although I hinted that I'm using local GPG key, I finally read the sops docs and came up with the following:

creation_rules:
  - path_regex: '.*'
    pgp: 'GPG key fingerprint'

Which works! Thanks for listening anyway.

DaPutzy commented 1 year ago

Hi,

Indeed the plugin requires a .sops.yaml to work :)

I will close the issue, but feel free to open it again if your issue was not solved.

DaPutzy commented 6 months ago

@plevart #22 will make it possbile to use the plugin without a .sops.yaml, feel free to have a look 🙃