Skip to content

Commit 5ef7c3d

Browse files
authored
docs(aws-kms-tls-auth): clarify security impact of failure modes (#5424)
1 parent af20607 commit 5ef7c3d

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

bindings/rust/aws-kms-tls-auth/DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Managing Algorithm & Format Changes.
22

33
## Backwards Compatibility: Required
4-
Changes must always be backwards compatible. More specifically, server's must always be able to deserialize earlier versions of PskIdentities, otherwise all of the in-flight communications would fail when an upgrade happens.
4+
Changes must always be backwards compatible. More specifically, servers must always be able to deserialize earlier versions of PskIdentities, otherwise all of the in-flight communications would fail when an upgrade happens.
55

66
## Forward Compatibility: Customer Responsibility
77
We generally do not promise forwards compatibility: A `0.0.1` V1 enabled server might not be able to handshake with a `0.0.2` V2 enabled client. We will strive to maintain forward compatibility, but if there was ever an upgrade from `AES_256_GCM_SIV` to `AES_512_GCM_SIV`, that would not be forward compatible.

bindings/rust/aws-kms-tls-auth/src/identity.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,17 @@ impl ObfuscationKey {
8484
}
8585

8686
fn aes_256_key(&self) -> anyhow::Result<LessSafeKey> {
87+
// The "LessSafe" key refers to the fact that we have to create our own
88+
// random nonces. A feature request is open to aws-lc-rs to support
89+
// AES-256-GCM-SIV for the safer RandomizedNonceKey.
90+
// https://github.com/aws/aws-lc-rs/issues/842
8791
Ok(LessSafeKey::new(UnboundKey::new(
8892
&AES_256_GCM_SIV,
8993
&self.material,
9094
)?))
9195
}
9296
}
9397

94-
#[derive(Debug, Clone)]
95-
pub(crate) struct KmsDataKey {
96-
pub ciphertext: Vec<u8>,
97-
pub plaintext: Vec<u8>,
98-
}
99-
10098
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
10199
pub(crate) struct PskIdentity {
102100
version: PskVersion,

bindings/rust/aws-kms-tls-auth/src/provider.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use crate::{
55
codec::EncodeValue,
6-
identity::{KmsDataKey, ObfuscationKey, PskIdentity, PskVersion},
6+
identity::{ObfuscationKey, PskIdentity, PskVersion},
77
psk_from_material, KeyArn, KEY_ROTATION_PERIOD, PSK_SIZE,
88
};
99
use aws_sdk_kms::Client;
@@ -15,6 +15,12 @@ use std::{
1515
};
1616
use tokio::time::Instant;
1717

18+
#[derive(Debug, Clone)]
19+
struct KmsDataKey {
20+
pub ciphertext: Vec<u8>,
21+
pub plaintext: Vec<u8>,
22+
}
23+
1824
/// The `PskProvider` is used along with the [`PskReceiver`] to perform TLS
1925
/// 1.3 out-of-band PSK authentication, using PSK's generated from KMS.
2026
///
@@ -25,7 +31,15 @@ use tokio::time::Instant;
2531
///
2632
/// Note that the "rotation check" only happens when a new connection is created.
2733
/// So if a new connection is only created every 2 hours, rotation might not be
28-
/// attempted until 26 hours have elapsed.
34+
/// attempted until 26 hours have elapsed. This results in a 26 hour old PSK being
35+
/// used for the connection.
36+
///
37+
/// ### ⚠️ WARNING ⚠️
38+
/// Because of the above behavior, this solution is not a good fit for
39+
/// extremely low tps scenarios. When performing ~ 1 connection per week or less,
40+
/// the low tps significantly slows key rotation. This does not cause any specific
41+
/// system failure, but long lived secrets do not align with cryptographic best
42+
/// practices.
2943
#[derive(Clone)]
3044
pub struct PskProvider {
3145
/// The version of PSK identities sent on the wire. Currently this is unused
@@ -79,6 +93,14 @@ impl PskProvider {
7993
/// tracing::error!("failed to rotate key: {error}");
8094
/// });
8195
/// ```
96+
///
97+
/// ### ⚠️ WARNING ⚠️
98+
/// Failing to take action on the `failure_notification` will result in the
99+
/// Provider continuing to use the same data key indefinitely. While this doesn't
100+
/// cause any specific system failure, long lived secrets do not align with
101+
/// cryptographic best practices. Longer lived secrets have a higher change
102+
/// of exposure, so customers should ensure that they alarm and troubleshoot
103+
/// rotation failures.
82104
pub async fn initialize(
83105
psk_version: PskVersion,
84106
kms_client: Client,

0 commit comments

Comments
 (0)