From 24f2a38e0efb02db1d210473eb84190b9e62e058 Mon Sep 17 00:00:00 2001 From: jrconlin Date: Tue, 23 Mar 2021 13:49:21 -0700 Subject: [PATCH 1/2] feat: Drop aesgcm128 support Closes: #266 --- Cargo.lock | 6 +-- .../src/extractors/notification_headers.rs | 38 +------------------ 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7101c7fb4..44bc6a5ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -392,7 +392,7 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "autoendpoint" -version = "1.57.5" +version = "1.57.6" dependencies = [ "a2", "actix-cors", @@ -443,7 +443,7 @@ dependencies = [ [[package]] name = "autopush" -version = "1.57.5" +version = "1.57.6" dependencies = [ "autopush_common", "base64 0.13.0", @@ -492,7 +492,7 @@ dependencies = [ [[package]] name = "autopush_common" -version = "1.57.5" +version = "1.57.6" dependencies = [ "base64 0.13.0", "cadence", diff --git a/autoendpoint/src/extractors/notification_headers.rs b/autoendpoint/src/extractors/notification_headers.rs index daeabc813..679acc578 100644 --- a/autoendpoint/src/extractors/notification_headers.rs +++ b/autoendpoint/src/extractors/notification_headers.rs @@ -122,7 +122,6 @@ impl NotificationHeaders { })?; match encoding { - "aesgcm128" => self.validate_encryption_01_rules()?, "aesgcm" => self.validate_encryption_04_rules()?, "aes128gcm" => self.validate_encryption_06_rules()?, _ => { @@ -136,16 +135,6 @@ impl NotificationHeaders { Ok(()) } - /// Validates encryption headers according to - /// draft-ietf-webpush-encryption-01 - fn validate_encryption_01_rules(&self) -> ApiResult<()> { - Self::assert_base64_item_exists("Encryption", self.encryption.as_deref(), "salt")?; - Self::assert_base64_item_exists("Encryption-Key", self.encryption_key.as_deref(), "dh")?; - Self::assert_not_exists("aesgcm128 Crypto-Key", self.crypto_key.as_deref(), "dh")?; - - Ok(()) - } - /// Validates encryption headers according to /// draft-ietf-webpush-encryption-04 fn validate_encryption_04_rules(&self) -> ApiResult<()> { @@ -351,32 +340,7 @@ mod tests { assert_encryption_error(result, "Missing Content-Encoding header"); } - /// Valid 01 draft encryption passes validation - #[test] - fn valid_01_encryption() { - let req = TestRequest::post() - .header("TTL", "10") - .header("Content-Encoding", "aesgcm128") - .header("Encryption", "salt=foo") - .header("Encryption-Key", "dh=bar") - .to_http_request(); - let result = NotificationHeaders::from_request(&req, true); - - assert!(result.is_ok()); - assert_eq!( - result.unwrap(), - NotificationHeaders { - ttl: 10, - topic: None, - encoding: Some("aesgcm128".to_string()), - encryption: Some("salt=foo".to_string()), - encryption_key: Some("dh=bar".to_string()), - crypto_key: None - } - ); - } - - /// Valid 04 draft encryption passes validation + /// Valid 04 draft encryption passes validationgit o #[test] fn valid_04_encryption() { let req = TestRequest::post() From 7855704495e641c8cfa273ea1b31ddda7809c77e Mon Sep 17 00:00:00 2001 From: jrconlin Date: Mon, 29 Mar 2021 16:33:17 -0700 Subject: [PATCH 2/2] f decruft --- autoendpoint/src/extractors/notification_headers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoendpoint/src/extractors/notification_headers.rs b/autoendpoint/src/extractors/notification_headers.rs index 679acc578..57724f1d8 100644 --- a/autoendpoint/src/extractors/notification_headers.rs +++ b/autoendpoint/src/extractors/notification_headers.rs @@ -340,7 +340,7 @@ mod tests { assert_encryption_error(result, "Missing Content-Encoding header"); } - /// Valid 04 draft encryption passes validationgit o + /// Valid 04 draft encryption passes validation #[test] fn valid_04_encryption() { let req = TestRequest::post()