getsops / getsops/sops

Decryption failed when different aws-profile names used

Open
#614 24 comments 9 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

This is a strange one, I seem to only be able to decrypt files that are made by the user that created the file.

If I try and decrypt another file it fails. Even though both files are encrypted with the same KMS key and both users have permissions to access the key within AWS.

sops --verbose --aws-profile saml -d madebyme.yaml

[AWSKMS]	 INFO[0000] Decryption succeeded                          arn="arn:aws:kms:us-west-2:123456:key/123123123123"
[SOPS]	 INFO[0000] Data key recovered successfully              
[SOPS]	 DEBU[0000] Decrypting tree                              
hello: Welcome to SOPS! Edit this file as you please!

sops --verbose --aws-profile saml -d madebyanother.yaml

[AWSKMS]	 INFO[0012] Decryption failed                             arn="arn:aws:kms:us-west-2:123456:key/123123123123"
[AWSKMS]	 INFO[0024] Decryption failed                             arn="arn:aws:kms:us-east-2:123456:key/456456456456"
Failed to get the data key required to decrypt the SOPS file.

Group 0: FAILED
  arn:aws:kms:us-west-2:123456:key/123123123123: FAILED
    - | Error decrypting key: NoCredentialProviders: no valid
      | providers in chain. Deprecated.
      | 	For verbose messaging see
      | aws.Config.CredentialsChainVerboseErrors
  
  arn:aws:kms:us-east-2:123456:key/456456456456: FAILED
    - | Error decrypting key: NoCredentialProviders: no valid
      | providers in chain. Deprecated.
      | 	For verbose messaging see
      | aws.Config.CredentialsChainVerboseErrors

Recovery failed because no master key was able to decrypt the file. In
order for SOPS to recover the file, at least one key has to be successful,
but none were.

If I use the AWS CLI I can also encrypt and decrypt files manually. Any ideas what else I should try?

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 two sops commands with the saml AWS profile and comparing them with the successful AWS CLI encryption and decryption. Investigate why the second file reports NoCredentialProviders for both KMS ARNs; done means decrypting another user's file with the shared KMS key and permitted credentials.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cli, cloud, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.