From 202fba6e031751958f2c8b5dee3d81f32e49699c Mon Sep 17 00:00:00 2001 From: JR Conlin Date: Tue, 16 Aug 2022 17:01:02 -0700 Subject: [PATCH] Bug/326 overflow (#327) bug: Silence data overflow error in sentry * also apply 1.63 clippy fixex Closes: #326 --- autoendpoint/src/error.rs | 4 +++- autoendpoint/src/extractors/routers.rs | 2 +- autoendpoint/src/headers/vapid.rs | 6 +++--- autoendpoint/src/routers/apns/router.rs | 1 + autoendpoint/src/routers/mod.rs | 2 +- autopush-common/src/db/models.rs | 2 +- autopush/src/megaphone.rs | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/autoendpoint/src/error.rs b/autoendpoint/src/error.rs index 36c80a890..f7addc534 100644 --- a/autoendpoint/src/error.rs +++ b/autoendpoint/src/error.rs @@ -200,7 +200,9 @@ impl ApiErrorKind { | ApiErrorKind::InvalidAuthentication | ApiErrorKind::InvalidLocalAuth(_) | // Ignore missing or invalid user errors - ApiErrorKind::NoUser | ApiErrorKind::NoSubscription, + ApiErrorKind::NoUser | ApiErrorKind::NoSubscription | + // Ignore overflow errors + ApiErrorKind::Router(RouterError::TooMuchData(_)), ) } diff --git a/autoendpoint/src/extractors/routers.rs b/autoendpoint/src/extractors/routers.rs index 66f0c893d..26dcf8cb7 100644 --- a/autoendpoint/src/extractors/routers.rs +++ b/autoendpoint/src/extractors/routers.rs @@ -13,7 +13,7 @@ use std::str::FromStr; use std::sync::Arc; /// Valid `DynamoDbUser::router_type` values -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[allow(clippy::upper_case_acronyms)] pub enum RouterType { WebPush, diff --git a/autoendpoint/src/headers/vapid.rs b/autoendpoint/src/headers/vapid.rs index b7d101dcf..bd98e9280 100644 --- a/autoendpoint/src/headers/vapid.rs +++ b/autoendpoint/src/headers/vapid.rs @@ -5,7 +5,7 @@ use thiserror::Error; pub const ALLOWED_SCHEMES: [&str; 3] = ["bearer", "webpush", "vapid"]; /// Parses the VAPID authorization header -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct VapidHeader { pub scheme: String, pub token: String, @@ -21,7 +21,7 @@ pub struct VapidHeaderWithKey { } /// Version-specific VAPID data. Also used to identify the VAPID version. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum VapidVersionData { Version1, Version2 { public_key: String }, @@ -77,7 +77,7 @@ impl VapidHeader { } } -#[derive(Debug, Error, PartialEq)] +#[derive(Debug, Error, Eq, PartialEq)] pub enum VapidError { #[error("Missing VAPID token")] MissingToken, diff --git a/autoendpoint/src/routers/apns/router.rs b/autoendpoint/src/routers/apns/router.rs index 03dfb9a2d..4a23ea234 100644 --- a/autoendpoint/src/routers/apns/router.rs +++ b/autoendpoint/src/routers/apns/router.rs @@ -335,6 +335,7 @@ mod tests { const DEVICE_TOKEN: &str = "test-token"; const APNS_ID: &str = "deadbeef-4f5e-4403-be8f-35d0251655f5"; + #[allow(clippy::type_complexity)] /// A mock APNS client which allows one to supply a custom APNS response/error struct MockApnsClient { send_fn: Box) -> Result + Send + Sync>, diff --git a/autoendpoint/src/routers/mod.rs b/autoendpoint/src/routers/mod.rs index 76e43ceff..bbccd63ec 100644 --- a/autoendpoint/src/routers/mod.rs +++ b/autoendpoint/src/routers/mod.rs @@ -34,7 +34,7 @@ pub trait Router { } /// The response returned when a router routes a notification -#[derive(Debug, PartialEq)] +#[derive(Debug, Eq, PartialEq)] pub struct RouterResponse { pub status: StatusCode, pub headers: HashMap<&'static str, String>, diff --git a/autopush-common/src/db/models.rs b/autopush-common/src/db/models.rs index 84a3b5c0e..3be9c5cbe 100644 --- a/autopush-common/src/db/models.rs +++ b/autopush-common/src/db/models.rs @@ -63,7 +63,7 @@ impl From> for NotificationHeaders { } } -#[derive(Deserialize, PartialEq, Debug, Clone, Serialize)] +#[derive(Deserialize, Eq, PartialEq, Debug, Clone, Serialize)] pub struct DynamoDbUser { // DynamoDB #[serde(serialize_with = "uuid_serializer")] diff --git a/autopush/src/megaphone.rs b/autopush/src/megaphone.rs index 8e0050687..e4169ce75 100644 --- a/autopush/src/megaphone.rs +++ b/autopush/src/megaphone.rs @@ -67,7 +67,7 @@ struct BroadcastRevision { // A provided Broadcast/Version used for `BroadcastSubsInit`, client comparisons, and outgoing // deltas -#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] pub struct Broadcast { broadcast_id: String, version: String,