From 29fe8e16a362b8f05a4bee96ec74da6174bb363b Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 2 Jul 2024 15:45:11 +0000 Subject: [PATCH] deploy: 1da2930bc24954ef8d61667ad74ad1cbd35806de --- .../contexts/fn.get_android_api_version.html | 2 +- .../contexts/fn.normalize_context.html | 2 +- relay_event_normalization/contexts/index.html | 2 +- relay_filter/fn.should_filter.html | 2 +- relay_filter/generic/index.html | 2 +- relay_filter/index.html | 2 +- relay_filter/struct.GenericFilterConfig.html | 4 +- .../condition/struct.GlobCondition.html | 4 +- .../normalize/contexts.rs.html | 108 +++++++++++++++--- 9 files changed, 103 insertions(+), 25 deletions(-) diff --git a/relay_event_normalization/contexts/fn.get_android_api_version.html b/relay_event_normalization/contexts/fn.get_android_api_version.html index 820c72772a..0873c5eba5 100644 --- a/relay_event_normalization/contexts/fn.get_android_api_version.html +++ b/relay_event_normalization/contexts/fn.get_android_api_version.html @@ -1,3 +1,3 @@ -get_android_api_version in relay_event_normalization::contexts - Rust
pub fn get_android_api_version(description: &str) -> Option<&str>
Expand description

Returns the API version of an Android description.

+get_android_api_version in relay_event_normalization::contexts - Rust
pub fn get_android_api_version(description: &str) -> Option<&str>
Expand description

Returns the API version of an Android description.

TODO use this to add a tag android.api to the message (not yet 100% decided)

\ No newline at end of file diff --git a/relay_event_normalization/contexts/fn.normalize_context.html b/relay_event_normalization/contexts/fn.normalize_context.html index 968fe01da7..e1ec08c7d6 100644 --- a/relay_event_normalization/contexts/fn.normalize_context.html +++ b/relay_event_normalization/contexts/fn.normalize_context.html @@ -1,2 +1,2 @@ -normalize_context in relay_event_normalization::contexts - Rust
pub fn normalize_context(context: &mut Context)
Expand description

Normalizes the given context.

+normalize_context in relay_event_normalization::contexts - Rust
pub fn normalize_context(context: &mut Context)
Expand description

Normalizes the given context.

\ No newline at end of file diff --git a/relay_event_normalization/contexts/index.html b/relay_event_normalization/contexts/index.html index 2e154fef5e..243134bf1f 100644 --- a/relay_event_normalization/contexts/index.html +++ b/relay_event_normalization/contexts/index.html @@ -1,2 +1,2 @@ -relay_event_normalization::contexts - Rust

Module relay_event_normalization::contexts

source ·
Expand description

Computation and normalization of contexts from event data.

+relay_event_normalization::contexts - Rust

Module relay_event_normalization::contexts

source ·
Expand description

Computation and normalization of contexts from event data.

Functions§

\ No newline at end of file diff --git a/relay_filter/fn.should_filter.html b/relay_filter/fn.should_filter.html index d6a3299d0e..0619ce1e28 100644 --- a/relay_filter/fn.should_filter.html +++ b/relay_filter/fn.should_filter.html @@ -1,4 +1,4 @@ -should_filter in relay_filter - Rust

Function relay_filter::should_filter

source ·
pub fn should_filter<F: Filterable + Getter>(
+should_filter in relay_filter - Rust

Function relay_filter::should_filter

source ·
pub fn should_filter<F: Filterable + Getter>(
     item: &F,
     client_ip: Option<IpAddr>,
     config: &ProjectFiltersConfig,
diff --git a/relay_filter/generic/index.html b/relay_filter/generic/index.html
index e21dc50dcf..6442ffee3d 100644
--- a/relay_filter/generic/index.html
+++ b/relay_filter/generic/index.html
@@ -1,4 +1,4 @@
-relay_filter::generic - Rust

Module relay_filter::generic

source ·
Expand description

Implements generic filtering based on the RuleCondition DSL.

+relay_filter::generic - Rust

Module relay_filter::generic

source ·
Expand description

Implements generic filtering based on the [RuleCondition] DSL.

Multiple generic filters can be defined and they are going to be checked in FIFO order. The first one that matches, will result in the event being discarded with a FilterStatKey identifying the matching filter.

diff --git a/relay_filter/index.html b/relay_filter/index.html index 10c1d04736..5a44ac6212 100644 --- a/relay_filter/index.html +++ b/relay_filter/index.html @@ -6,4 +6,4 @@
  • web crawlers (filter events sent by user agents known to be web crawlers)
  • legacy browsers (filter events originating from legacy browsers, can be configured)
  • -

    Re-exports§

    Modules§

    • Implements filtering for events caused by problematic browsers extensions.
    • Implements event filtering based on the client ip address.
    • Implements event filtering for events originating from CSP endpoints
    • Implements event filtering based on the error message
    • Implements generic filtering based on the RuleCondition DSL.
    • Implements filtering for events originating from legacy browsers.
    • Implements filtering for events originating from the localhost
    • Implements event filtering based on whether the endpoint called is a healthcheck endpoint.
    • Filters events coming from user agents known to be web crawlers.

    Structs§

    Enums§

    • Identifies which filter dropped an event for which reason.
    • A browser class to be filtered by the legacy browser filter.

    Traits§

    • A data item to which filters can be applied.

    Functions§

    • Checks whether an event should be filtered for a particular configuration.
    \ No newline at end of file +

    Re-exports§

    Modules§

    • Implements filtering for events caused by problematic browsers extensions.
    • Implements event filtering based on the client ip address.
    • Implements event filtering for events originating from CSP endpoints
    • Implements event filtering based on the error message
    • Implements generic filtering based on the [RuleCondition] DSL.
    • Implements filtering for events originating from legacy browsers.
    • Implements filtering for events originating from the localhost
    • Implements event filtering based on whether the endpoint called is a healthcheck endpoint.
    • Filters events coming from user agents known to be web crawlers.

    Structs§

    Enums§

    • Identifies which filter dropped an event for which reason.
    • A browser class to be filtered by the legacy browser filter.

    Traits§

    • A data item to which filters can be applied.

    Functions§

    • Checks whether an event should be filtered for a particular configuration.
    \ No newline at end of file diff --git a/relay_filter/struct.GenericFilterConfig.html b/relay_filter/struct.GenericFilterConfig.html index ea28fe7b4c..856af6c24b 100644 --- a/relay_filter/struct.GenericFilterConfig.html +++ b/relay_filter/struct.GenericFilterConfig.html @@ -1,11 +1,11 @@ GenericFilterConfig in relay_filter - Rust

    Struct relay_filter::GenericFilterConfig

    source ·
    pub struct GenericFilterConfig {
         pub id: String,
         pub is_enabled: bool,
    -    pub condition: Option<RuleCondition>,
    +    pub condition: Option<RuleCondition>,
     }
    Expand description

    Configuration for a generic filter.

    Fields§

    §id: String

    Unique identifier of the generic filter.

    §is_enabled: bool

    Specifies whether this filter is enabled.

    -
    §condition: Option<RuleCondition>

    The condition for the filter.

    +
    §condition: Option<RuleCondition>

    The condition for the filter.

    Implementations§

    source§

    impl GenericFilterConfig

    source

    pub fn is_empty(&self) -> bool

    Returns true if the filter is not enabled or no condition was supplied.

    Trait Implementations§

    source§

    impl Clone for GenericFilterConfig

    source§

    fn clone(&self) -> GenericFilterConfig

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for GenericFilterConfig

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl Default for GenericFilterConfig

    source§

    fn default() -> GenericFilterConfig

    Returns the “default value” for a type. Read more
    source§

    impl<'de> Deserialize<'de> for GenericFilterConfig

    source§

    fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
    where __D: Deserializer<'de>,

    Deserialize this value from the given Serde deserializer. Read more
    source§

    impl PartialEq for GenericFilterConfig

    source§

    fn eq(&self, other: &GenericFilterConfig) -> bool

    This method tests for self and other values to be equal, and is used diff --git a/relay_protocol/condition/struct.GlobCondition.html b/relay_protocol/condition/struct.GlobCondition.html index 340a0a4cc9..85a22bfd70 100644 --- a/relay_protocol/condition/struct.GlobCondition.html +++ b/relay_protocol/condition/struct.GlobCondition.html @@ -1,12 +1,12 @@ GlobCondition in relay_protocol::condition - Rust

    Struct relay_protocol::condition::GlobCondition

    source ·
    pub struct GlobCondition {
         pub name: String,
    -    pub value: GlobPatterns,
    +    pub value: GlobPatterns,
     }
    Expand description

    A condition that uses glob matching.

    This is similar to EqCondition, but it allows for wildcards in value. This is slightly more expensive to construct and check, so preferrably use EqCondition when no wildcard matching is needed.

    Fields§

    §name: String

    Path of the field that should match the value.

    -
    §value: GlobPatterns

    A list of glob patterns to check.

    +
    §value: GlobPatterns

    A list of glob patterns to check.

    Note that this cannot be a single value, it must be a list of values.

    Implementations§

    source§

    impl GlobCondition

    source

    pub fn new(field: impl Into<String>, value: impl IntoStrings) -> Self

    Creates a condition that matches one or more glob patterns.

    Trait Implementations§

    source§

    impl Clone for GlobCondition

    source§

    fn clone(&self) -> GlobCondition

    Returns a copy of the value. Read more
    1.0.0 · source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    source§

    impl Debug for GlobCondition

    source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    source§

    impl<'de> Deserialize<'de> for GlobCondition

    source§

    fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
    where diff --git a/src/relay_event_normalization/normalize/contexts.rs.html b/src/relay_event_normalization/normalize/contexts.rs.html index a83aa30c3a..772c528279 100644 --- a/src/relay_event_normalization/normalize/contexts.rs.html +++ b/src/relay_event_normalization/normalize/contexts.rs.html @@ -733,6 +733,45 @@ 733 734 735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774

    //! Computation and normalization of contexts from event data.
     
     use std::collections::HashMap;
    @@ -760,6 +799,14 @@
         Regex::new(r"^Mac OS X (?P<version>\d+\.\d+\.\d+)( \((?P<build>[a-fA-F0-9]+)\))?$").unwrap()
     });
     
    +/// Format sent by Unity on iOS
    +static OS_IOS_REGEX: Lazy<Regex> =
    +    Lazy::new(|| Regex::new(r"^iOS (?P<version>\d+\.\d+\.\d+)").unwrap());
    +
    +/// Format sent by Unity on iPadOS
    +static OS_IPADOS_REGEX: Lazy<Regex> =
    +    Lazy::new(|| Regex::new(r"^iPadOS (?P<version>\d+\.\d+\.\d+)").unwrap());
    +
     /// Specific regex to parse Linux distros
     static OS_LINUX_DISTRO_UNAME_REGEX: Lazy<Regex> = Lazy::new(|| {
         Regex::new(r"^Linux (?P<kernel_version>\d+\.\d+(\.\d+(\.[1-9]+)?)?) (?P<name>[a-zA-Z]+) (?P<version>\d+(\.\d+){0,2})").unwrap()
    @@ -931,6 +978,26 @@
                     .name("build")
                     .map(|m| m.as_str().to_string().into())
                     .into();
    +        } else if let Some(captures) = OS_IOS_REGEX.captures(raw_description) {
    +            os.name = "iOS".to_string().into();
    +            os.version = captures
    +                .name("version")
    +                .map(|m| m.as_str().to_string())
    +                .into();
    +            os.build = captures
    +                .name("build")
    +                .map(|m| m.as_str().to_string().into())
    +                .into();
    +        } else if let Some(captures) = OS_IPADOS_REGEX.captures(raw_description) {
    +            os.name = "iPadOS".to_string().into();
    +            os.version = captures
    +                .name("version")
    +                .map(|m| m.as_str().to_string())
    +                .into();
    +            os.build = captures
    +                .name("build")
    +                .map(|m| m.as_str().to_string().into())
    +                .into();
             } else if let Some(captures) = OS_LINUX_DISTRO_UNAME_REGEX.captures(raw_description) {
                 os.name = captures.name("name").map(|m| m.as_str().to_string()).into();
                 os.version = captures
    @@ -1344,6 +1411,32 @@
             assert_eq!(None, os.build.value());
         }
     
    +    #[test]
    +    fn test_unity_ios() {
    +        let mut os = OsContext {
    +            raw_description: "iOS 17.5.1".to_string().into(),
    +            ..OsContext::default()
    +        };
    +
    +        normalize_os_context(&mut os);
    +        assert_eq!(Some("iOS"), os.name.as_str());
    +        assert_eq!(Some("17.5.1"), os.version.as_str());
    +        assert_eq!(None, os.build.value());
    +    }
    +
    +    #[test]
    +    fn test_unity_ipados() {
    +        let mut os = OsContext {
    +            raw_description: "iPadOS 17.5.1".to_string().into(),
    +            ..OsContext::default()
    +        };
    +
    +        normalize_os_context(&mut os);
    +        assert_eq!(Some("iPadOS"), os.name.as_str());
    +        assert_eq!(Some("17.5.1"), os.version.as_str());
    +        assert_eq!(None, os.build.value());
    +    }
    +
         //OS_WINDOWS_REGEX = r#"^(Microsoft )?Windows (NT )?(?P<version>\d+\.\d+\.\d+).*$"#;
         #[test]
         fn test_unity_windows_os() {
    @@ -1404,21 +1497,6 @@
             assert_eq!(None, os.build.value());
         }
     
    -    #[test]
    -    fn test_ios_15_0() {
    -        let mut os = OsContext {
    -            raw_description: "iOS 15.0".to_string().into(),
    -            ..OsContext::default()
    -        };
    -        normalize_os_context(&mut os);
    -        assert_eq!(Some("iOS"), os.name.as_str());
    -
    -        // XXX: This behavior of putting it into kernel_version vs version is probably not desired and
    -        // may be revisited
    -        assert_eq!(Some("15.0"), os.kernel_version.as_str());
    -        assert_eq!(None, os.build.value());
    -    }
    -
         #[test]
         fn test_infer_json() {
             let mut response = ResponseContext {