|
| 1 | +[//]: # "Copyright Amazon.com Inc. or its affiliates. All Rights Reserved." |
| 2 | +[//]: # "SPDX-License-Identifier: CC-BY-SA-4.0" |
| 3 | + |
| 4 | +# Define Branch Key Store read consistency semantics |
| 5 | + |
| 6 | +# Definitions |
| 7 | + |
| 8 | +## Conventions used in this document |
| 9 | + |
| 10 | +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", |
| 11 | +"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be |
| 12 | +interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). |
| 13 | + |
| 14 | +# Background |
| 15 | + |
| 16 | +The [branch key store](../../framework/branch-key-store.md) persists branch key versions |
| 17 | +in a persistent data store such as a DynamoDb table. |
| 18 | + |
| 19 | +These distributed data stores often offer configurable read consistency, |
| 20 | +allowing customers to choose eventually consistent reads |
| 21 | +for optimal cost and performance |
| 22 | +if stale results are acceptable for their use-case. |
| 23 | + |
| 24 | +The current specification does not specify when agents should expect |
| 25 | +the results of the read operations to reflect the updated state caused by mutation operations. |
| 26 | + |
| 27 | +The current implementation utilizes eventually consistent reads in all current usage. |
| 28 | + |
| 29 | +Consequently, a read operation will not necessarily reflect the latest results a mutation operation |
| 30 | +even if performed by the same agent in a serialized manner. |
| 31 | + |
| 32 | +This change adds the option to require consistent reads and |
| 33 | +clarifies the required consistent read behavior for read operations. |
| 34 | + |
| 35 | +## Detailed Explanation |
| 36 | + |
| 37 | +The Branch Key Store's `GetActiveBranchKey`, `GetBranchKeyVersion`, and `GetBeaconKey` operations |
| 38 | +utilize AWS DDB `GetItem` calls which |
| 39 | +do not set the `ConsistentRead` flag. |
| 40 | + |
| 41 | +When the `ConsistentRead` flag is unset or `false`, |
| 42 | +DynamoDb only provides eventually consistent read guarantees. |
| 43 | + |
| 44 | +This eventually consistent behavior is intentional |
| 45 | +in order to optimize performance and cost. |
| 46 | + |
| 47 | +However, |
| 48 | +customers may have non-standard situations |
| 49 | +which explicitly require consistent reads to be performed. |
| 50 | + |
| 51 | +While key management operations SHOULD occur in control plane operations, |
| 52 | +those same control plane operations MAY need to perform encryption operations. |
| 53 | + |
| 54 | +Usage of consistent reads ensures that encryption operations |
| 55 | +immediately following the `CreateKey` operation |
| 56 | +will be able to find the created keys. |
| 57 | + |
| 58 | +Similarly, |
| 59 | +key rotation and re-encryption operations |
| 60 | +performed due to key compromise |
| 61 | +MUST use consistent reads to ensure that |
| 62 | +the encryption operations utilize the new branch key version. |
| 63 | + |
| 64 | +# Changes |
| 65 | + |
| 66 | +The change is to introduce a new, optional `Require Consistent Reads` option |
| 67 | +to the Branch Key Store specification. |
| 68 | + |
| 69 | +This updates: |
| 70 | + |
| 71 | +- The [Branch Key Store's Initialization](../../framework/branch-key-store.md#initialization) |
| 72 | +- The [Branch Key Store's GetActiveBranchKey operation](../../framework/branch-key-store.md#getactivebranchkey) |
| 73 | +- The [Branch Key Store's GetBranchKeyVersion operation](../../framework/branch-key-store.md#getbranchkeyversion) |
| 74 | +- The [Branch Key Store's GetBeaconKey operation](../../framework/branch-key-store.md#getbeaconkey) |
| 75 | + |
| 76 | +This update clarifies the existing behavior in a backwards-compatible manner |
| 77 | +while allowing agents to opt-in to consistent reads when needed. |
0 commit comments