Skip to content

Add encryption context to KMS calls#2734

Merged
jmhooper merged 3 commits intomasterfrom
jmhooper-kms-encryption-context
Feb 15, 2019
Merged

Add encryption context to KMS calls#2734
jmhooper merged 3 commits intomasterfrom
jmhooper-kms-encryption-context

Conversation

@jmhooper
Copy link
Contributor

@jmhooper jmhooper commented Feb 4, 2019

Why: So we can use the cloudtrail output to monitor KMS usage.

This commit moves the old KMS client into a new client called
ContextlessKmsClient. After moving the PII data out of that KMS client
it can be deperecated and maintained as legacy code with the UAK
password encryptor.

The new KMS client requires a context hash to perform encryption.

This commit includes the ability to enable writes with KMS contexts by
flipping a feature flag. This defaults to off. This means that the
change can be deployed to read KMS ciphertexts with or without a context, but
only writes without. Once the new change is deployed and the old
instances are scaled in, that flag can be flipped so that the next set
of instances will write ciphertexts with a context and all instances
will be able to read them.

Rollplan:

  1. Recycle with this change
  2. Test that everything works as expected, old ciphertexts can be
    decrypted
  3. Flip the use_kms_contexts flag to true
  4. Recycle to pick up the config change
  5. Test that everything works as expected, new and old ciphertexts can
    be decrypted

**Why**: So we can use the cloudtrail output to monitor KMS usage.

This commit moves the old KMS client into a new client called
`ContextlessKmsClient`. After moving the PII data out of that KMS client
it can be deperecated and maintained as legacy code with the UAK
password encryptor.

The new KMS client requires a context hash to perform encryption.

This commit includes the ability to enable writes with KMS contexts by
flipping a feature flag. This defaults to off. This means that the
change can be deployed to read KMS ciphertexts with or without a context, but
only writes without. Once the new change is deployed and the old
instances are scaled in, that flag can be flipped so that the next set
of instances will write ciphertexts with a context and all instances
will be able to read them.

Rollplan:

1. Recycle with this change
2. Test that everything works as expected, old ciphertexts can be
decrypted
3. Flip the `use_kms_contexts` flag to `true`
4. Recycle to pick up the config change
5. Test that everything works as expected, new and old ciphertexts can
be decrypted
@jmhooper jmhooper merged commit 10f1a72 into master Feb 15, 2019
@jmhooper jmhooper deleted the jmhooper-kms-encryption-context branch February 15, 2019 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants