Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ proc-macro-crate,https://github.com/bkchr/proc-macro-crate,MIT OR Apache-2.0,Bas
proc-macro-error,https://gitlab.com/CreepySkeleton/proc-macro-error,MIT OR Apache-2.0,CreepySkeleton <creepy-skeleton@yandex.ru>
proc-macro-error-attr,https://gitlab.com/CreepySkeleton/proc-macro-error,MIT OR Apache-2.0,CreepySkeleton <creepy-skeleton@yandex.ru>
proc-macro2,https://github.com/dtolnay/proc-macro2,MIT OR Apache-2.0,"David Tolnay <dtolnay@gmail.com>, Alex Crichton <alex@alexcrichton.com>"
proc-macro2-diagnostics,https://github.com/SergioBenitez/proc-macro2-diagnostics,MIT OR Apache-2.0,Sergio Benitez <sb@sergio.bz>
prost,https://github.com/tokio-rs/prost,Apache-2.0,"Dan Burkert <dan@danburkert.com>, Lucio Franco <luciofranco14@gmail.com>, Casper Meijn <casper@meijn.net>, Tokio Contributors <team@tokio.rs>"
prost-derive,https://github.com/tokio-rs/prost,Apache-2.0,"Dan Burkert <dan@danburkert.com>, Lucio Franco <luciofranco14@gmail.com>, Casper Meijn <casper@meijn.net>, Tokio Contributors <team@tokio.rs>"
prost-types,https://github.com/tokio-rs/prost,Apache-2.0,"Dan Burkert <dan@danburkert.com>, Lucio Franco <luciofranco14@gmail.com>, Casper Meijn <casper@meijn.net>, Tokio Contributors <team@tokio.rs>"
Expand Down
1 change: 1 addition & 0 deletions libdd-data-pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ tokio = { version = "1.23", features = [
"time",
"test-util",
], default-features = false }
duplicate = "2.0.1"

[features]
default = ["https", "telemetry"]
Expand Down
32 changes: 26 additions & 6 deletions libdd-data-pipeline/src/agent_info/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,23 +408,43 @@ mod single_threaded_tests {
},
"remove_stack_traces": false,
"redis": {
"enabled": true,
"remove_all_args": false
"Enabled": true,
"RemoveAllArgs": false
},
"memcached": {
"enabled": true,
"keep_command": false
"Enabled": true,
"KeepCommand": false
}
}
},
"peer_tags": ["db.hostname","http.host","aws.s3.bucket"]
"peer_tags": ["db.hostname","http.host","aws.s3.bucket"],
"obfuscation_version": 1,
"filter_tags": {
"reject": [
"appsec.events.system_tests_appsec_event.value:tf-reject-exact"
],
"require": [
"appsec.events.system_tests_appsec_event.value:tf-require-exact"
]
},
"filter_tags_regex": {
"reject": [
"appsec.events.system_tests_appsec_event.value:tf-reject-regex-.*"
],
"require": [
"appsec.events.system_tests_appsec_event.value:tf-require-regex-.*"
]
},
"ignore_resources": [
".*(stats-unique|StatsUniqueHandler).*"
]
}"#;

fn calculate_hash(json: &str) -> String {
format!("{:x}", Sha256::digest(json.as_bytes()))
}

const TEST_INFO_HASH: &str = "cce54bf6e7d1bf38088a3ec809bfeec160bc52d37f70bd6b581ce3c2f7be5a65";
const TEST_INFO_HASH: &str = "d0f6dde2c1ef3b7b776a58162d42574346e23f4677c3fafb440f5c7ca83a8a28";

#[cfg_attr(miri, ignore)]
#[tokio::test]
Expand Down
87 changes: 87 additions & 0 deletions libdd-data-pipeline/src/agent_info/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,100 @@ pub struct HttpObfuscationConfig {
#[allow(missing_docs)]
#[derive(Clone, Serialize, Deserialize, Default, Debug, PartialEq)]
pub struct RedisObfuscationConfig {
// Agent sent pascal case fields here in versions <7.79.0
#[serde(alias = "Enabled")]
pub enabled: bool,
#[serde(alias = "RemoveAllArgs")]
pub remove_all_args: bool,
}

#[allow(missing_docs)]
#[derive(Clone, Serialize, Deserialize, Default, Debug, PartialEq)]
pub struct MemcachedObfuscationConfig {
// Agent sent pascal case fields here in versions <7.79.0
#[serde(alias = "Enabled")]
pub enabled: bool,
#[serde(alias = "KeepCommand")]
pub keep_command: bool,
}

#[cfg(test)]
mod tests {
use super::AgentInfoStruct;
#[duplicate::duplicate_item(
test_name input;
[parse_empty] ["{}"];
[parse_old_obfuscation_config] [r#"{
"config": {
"obfuscation": {
"elastic_search": true,
"mongo": true,
"sql_exec_plan": false,
"sql_exec_plan_normalize": false,
"http": {
"remove_query_string": false,
"remove_path_digits": false
},
"remove_stack_traces": false,
"redis": {
"Enabled": true,
"RemoveAllArgs": false
},
"memcached": {
"Enabled": true,
"KeepCommand": false
}
}
}
}"#];
[parse_new_obfuscation_config] [r#"{
"config": {
"obfuscation": {
"elastic_search": true,
"mongo": true,
"sql_exec_plan": false,
"sql_exec_plan_normalize": false,
"http": {
"remove_query_string": false,
"remove_path_digits": false
},
"remove_stack_traces": false,
"redis": {
"enabled": true,
"remove_all_args": false
},
"memcached": {
"enabled": true,
"keep_command": false
}
}
}
}"#];
[parse_filter_tags] [r#"{
"filter_tags": {
"reject": [
"appsec.events.system_tests_appsec_event.value:tf-reject-exact"
],
"require": [
"appsec.events.system_tests_appsec_event.value:tf-require-exact"
]
},
"filter_tags_regex": {
"reject": [
"appsec.events.system_tests_appsec_event.value:tf-reject-regex-.*"
],
"require": [
"appsec.events.system_tests_appsec_event.value:tf-require-regex-.*"
]
},
"ignore_resources": [
".*(stats-unique|StatsUniqueHandler).*"
]
}"#]
)]
#[test]
fn test_name() {
let _info: AgentInfoStruct = serde_json::from_str(input)
.expect("AgentInfoStruct should be parsed successfully from input");
}
}
Loading