getsops / getsops/sops

Use multiple KMS keys from different AWS accounts

Open
#650 9 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I've got KMS keys on accounts A and B. I need to be able to decrypt my secrets with both A and B keys. Sadly, due to security limitations I cannot use SOPS feature which assumes AWS role with the access to other account resources.

The work around I was thinking about was:

  1. Assume role for AWS account A
  2. Create encrypted file with key A
  3. Open encrypted file for manual edition with sops -s -i <file>
  4. Add there new arn to KMS entries
  5. Assume role for AWS account B
  6. Save the file and close the editor which should trigger adding my additional KMS key from account B (I presume at this moment current encryption key is already encrypted so there's no need to reach account A since SOPS only needs to encrypt it with account B - is this correct?)

Alas, when I close the editor I receive:

[CMD]	 ERRO[0020] SOPS metadata is invalid. Press a key to return to the editor, or Ctrl+C to exit.  error="parsing time \"\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"\" as \"2006\""

Is it a known issue? Maybe I open it wrong. Are there any other solutions to my problem? I was also trying updatekeys and --add-kms options but these requires both AWS accounts to be reachable at the same time.

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

Start by reproducing the editor flow with sops -s -i and the reported metadata error, then inspect the updatekeys and --add-kms entry points. Determine how adding a KMS key across separate AWS sessions should work without requiring both accounts to be reachable. Done means keys from both accounts can be added and used to decrypt the same file, with valid metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
cli, cloud, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.