getsops / getsops/sops

[Question] Encrypt using the same data key

Open
#2,008 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/CLI enhancement
Dominant language
Go
Stars
23.1k
Forks
1.1k
Avg merge
1d 11h
Merged PRs (30d)
9

Description

I am building a custom python wrapper over sops (called via subprocess), and i currently am following this approach

  1. Decrypt the file to stdout
  2. Convert that yaml content into a python dict
  3. Operate on the dict in memory
  4. Encrypt it and dump it back to the same file path

This works great and all but, it will always re-encrypt the entire file (and uses a different data key), which makes sense.

The reason why I'm doing it like this is because it's easier to operate on a dict rather than having to do type conversions, dump as json string, etc.

I am wondering, is there a reasonable way I could do this where sops would use the same data key to encrypt the context again before saving it to the final file path ?

Thank you

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

The issue names no repository file, test, or entry point. Start by reviewing the described Python subprocess flow and how SOPS handles data keys during decrypt and re-encrypt operations. Done means determining whether reusing the same data key is supported and documenting the confirmed behavior or required interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.