mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-15 19:38:11 +00:00
Update chrono
, remove time
to fix audit failures (#2285)
Closes #1366 and incidentally closes #1266. Requires using a not-yet-merged modification to the latest version of `appinsights-rs` to remove the `time` feature from the `chrono` dependency (https://github.com/dmolokanov/appinsights-rs/pull/280). There are changes to use the new (tokio-based) version of `appinsights-rs`, e.g., made `set_appinsights_clients` async to ensure it is always called from an async context, since the constructor for appinsights now invokes `Tokio::spawn`.
This commit is contained in:
35
src/agent/Cargo.lock
generated
35
src/agent/Cargo.lock
generated
@ -49,11 +49,14 @@ checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "appinsights"
|
name = "appinsights"
|
||||||
version = "0.1.5"
|
version = "0.2.2"
|
||||||
source = "git+https://github.com/dmolokanov/appinsights-rs?rev=0af6ec83bad1c050160f5258ab08e9834596ce20#0af6ec83bad1c050160f5258ab08e9834596ce20"
|
source = "git+https://github.com/Porges/appinsights-rs?rev=8264e0236c7a2729c4af4a2ba0017ca0270d7d0e#8264e0236c7a2729c4af4a2ba0017ca0270d7d0e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
"chrono",
|
"chrono",
|
||||||
"crossbeam-channel",
|
"crossbeam-queue",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-util",
|
||||||
"hostname",
|
"hostname",
|
||||||
"http",
|
"http",
|
||||||
"log",
|
"log",
|
||||||
@ -62,6 +65,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sm",
|
"sm",
|
||||||
|
"tokio",
|
||||||
"uuid 0.8.2",
|
"uuid 0.8.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -152,7 +156,7 @@ dependencies = [
|
|||||||
"rustc_version",
|
"rustc_version",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"time 0.3.13",
|
"time",
|
||||||
"url",
|
"url",
|
||||||
"uuid 1.1.2",
|
"uuid 1.1.2",
|
||||||
]
|
]
|
||||||
@ -177,7 +181,7 @@ dependencies = [
|
|||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2",
|
||||||
"time 0.3.13",
|
"time",
|
||||||
"url",
|
"url",
|
||||||
"uuid 1.1.2",
|
"uuid 1.1.2",
|
||||||
]
|
]
|
||||||
@ -200,7 +204,7 @@ dependencies = [
|
|||||||
"serde-xml-rs",
|
"serde-xml-rs",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"time 0.3.13",
|
"time",
|
||||||
"url",
|
"url",
|
||||||
"uuid 1.1.2",
|
"uuid 1.1.2",
|
||||||
]
|
]
|
||||||
@ -382,14 +386,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.19"
|
version = "0.4.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
checksum = "6127248204b9aba09a362f6c930ef6a78f2c1b2215f8a7b398c06e1083f17af0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"js-sys",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"time 0.1.43",
|
"wasm-bindgen",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2248,7 +2252,6 @@ checksum = "0941606b9934e2d98a3677759a971756eb821f75764d0e0d26946d08e74d9104"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"chrono",
|
|
||||||
"flate2",
|
"flate2",
|
||||||
"hex",
|
"hex",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -3133,16 +3136,6 @@ dependencies = [
|
|||||||
"syn 1.0.95",
|
"syn 1.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.1.43"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.13"
|
version = "0.3.13"
|
||||||
|
@ -19,3 +19,8 @@ members = [
|
|||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "thin"
|
lto = "thin"
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
# TODO: remove once PR is merged upstream https://github.com/dmolokanov/appinsights-rs/pull/280
|
||||||
|
# this rev is on the branch 'audit-fixes'
|
||||||
|
appinsights = { git = "https://github.com/Porges/appinsights-rs", rev="8264e0236c7a2729c4af4a2ba0017ca0270d7d0e" }
|
||||||
|
@ -35,7 +35,9 @@ winapi = "0.3"
|
|||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
pete = "0.9"
|
pete = "0.9"
|
||||||
procfs = "0.12"
|
# For procfs, opt out of the `chrono` freature; it pulls in an old version
|
||||||
|
# of `time`. We do not use the methods that the `chrono` feature enables.
|
||||||
|
procfs = { version = "0.12", default-features = false, features=["flate2"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
|
@ -173,15 +173,17 @@ fn run(opt: RunOpt) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We can't send telemetry if this fails.
|
// We can't send telemetry if this fails.
|
||||||
let config = load_config(opt);
|
let rt = tokio::runtime::Runtime::new()?;
|
||||||
|
let config = rt.block_on(load_config(opt));
|
||||||
|
|
||||||
|
// We can't send telemetry, because we couldn't get a telemetry key from the config.
|
||||||
|
// Instead, log to an assumed-redirected stdout for the sake of debugging.
|
||||||
if let Err(err) = &config {
|
if let Err(err) = &config {
|
||||||
error!("error loading supervisor agent config: {:?}", err);
|
error!("error loading supervisor agent config: {:?}", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
let config = config?;
|
let config = config?;
|
||||||
|
|
||||||
let rt = tokio::runtime::Runtime::new()?;
|
|
||||||
let result = rt.block_on(run_agent(config));
|
let result = rt.block_on(run_agent(config));
|
||||||
|
|
||||||
if let Err(err) = &result {
|
if let Err(err) = &result {
|
||||||
@ -191,12 +193,12 @@ fn run(opt: RunOpt) -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
telemetry::try_flush_and_close();
|
rt.block_on(telemetry::try_flush_and_close());
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_config(opt: RunOpt) -> Result<StaticConfig> {
|
async fn load_config(opt: RunOpt) -> Result<StaticConfig> {
|
||||||
info!("loading supervisor agent config");
|
info!("loading supervisor agent config");
|
||||||
|
|
||||||
let config = match &opt.config_path {
|
let config = match &opt.config_path {
|
||||||
@ -204,7 +206,7 @@ fn load_config(opt: RunOpt) -> Result<StaticConfig> {
|
|||||||
None => StaticConfig::from_env()?,
|
None => StaticConfig::from_env()?,
|
||||||
};
|
};
|
||||||
|
|
||||||
init_telemetry(&config);
|
init_telemetry(&config).await;
|
||||||
|
|
||||||
Ok(config)
|
Ok(config)
|
||||||
}
|
}
|
||||||
@ -320,9 +322,10 @@ async fn run_agent(config: StaticConfig) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_telemetry(config: &StaticConfig) {
|
async fn init_telemetry(config: &StaticConfig) {
|
||||||
telemetry::set_appinsights_clients(
|
telemetry::set_appinsights_clients(
|
||||||
config.instance_telemetry_key.clone(),
|
config.instance_telemetry_key.clone(),
|
||||||
config.microsoft_telemetry_key.clone(),
|
config.microsoft_telemetry_key.clone(),
|
||||||
);
|
)
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ tokio-stream = "0.1"
|
|||||||
tui = { version = "0.18", default-features = false, features = ['crossterm'] }
|
tui = { version = "0.18", default-features = false, features = ['crossterm'] }
|
||||||
url = { version = "2.2", features = ["serde"] }
|
url = { version = "2.2", features = ["serde"] }
|
||||||
uuid = { version = "0.8", features = ["serde", "v4"] }
|
uuid = { version = "0.8", features = ["serde", "v4"] }
|
||||||
chrono = "0.4"
|
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||||
|
|
||||||
azure_core = { version = "0.4", default-features = false, features = ["enable_reqwest_rustls"] }
|
azure_core = { version = "0.4", default-features = false, features = ["enable_reqwest_rustls"] }
|
||||||
azure_storage = { version = "0.5", default-features = false, features = ["enable_reqwest_rustls"] }
|
azure_storage = { version = "0.5", default-features = false, features = ["enable_reqwest_rustls"] }
|
||||||
|
@ -20,7 +20,7 @@ pub async fn run(args: &clap::ArgMatches<'_>) -> Result<()> {
|
|||||||
let setup_dir = value_t!(args, "setup_dir", PathBuf)?;
|
let setup_dir = value_t!(args, "setup_dir", PathBuf)?;
|
||||||
let config = Config::from_file(config_path, setup_dir)?;
|
let config = Config::from_file(config_path, setup_dir)?;
|
||||||
|
|
||||||
init_telemetry(config.common());
|
init_telemetry(config.common()).await;
|
||||||
|
|
||||||
let min_available_memory_bytes = 1_000_000 * config.common().min_available_memory_mb;
|
let min_available_memory_bytes = 1_000_000 * config.common().min_available_memory_mb;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ pub async fn run(args: &clap::ArgMatches<'_>) -> Result<()> {
|
|||||||
error!("error running task: {:?}", err);
|
error!("error running task: {:?}", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
onefuzz_telemetry::try_flush_and_close();
|
onefuzz_telemetry::try_flush_and_close().await;
|
||||||
|
|
||||||
// wait for the task logger to finish
|
// wait for the task logger to finish
|
||||||
if let Some(task_logger) = task_logger {
|
if let Some(task_logger) = task_logger {
|
||||||
@ -111,11 +111,12 @@ struct OutOfMemory {
|
|||||||
min_bytes: u64,
|
min_bytes: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_telemetry(config: &CommonConfig) {
|
async fn init_telemetry(config: &CommonConfig) {
|
||||||
onefuzz_telemetry::set_appinsights_clients(
|
onefuzz_telemetry::set_appinsights_clients(
|
||||||
config.instance_telemetry_key.clone(),
|
config.instance_telemetry_key.clone(),
|
||||||
config.microsoft_telemetry_key.clone(),
|
config.microsoft_telemetry_key.clone(),
|
||||||
);
|
)
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn args(name: &str) -> App<'static, 'static> {
|
pub fn args(name: &str) -> App<'static, 'static> {
|
||||||
|
@ -11,12 +11,8 @@ z3 = ["z3-sys"]
|
|||||||
intel_instructions = ["iced-x86"]
|
intel_instructions = ["iced-x86"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# appinsights-rs haas included optional support for rustls since 2020-10, but
|
|
||||||
# not the feature has not been released yet. This is the pinned to the most
|
|
||||||
# recent git hash as of 2021-06-30. Once released, this should be reverted to
|
|
||||||
# use released versions
|
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
appinsights = { git = "https://github.com/dmolokanov/appinsights-rs", rev = "0af6ec83bad1c050160f5258ab08e9834596ce20", features=["rustls"], default-features = false }
|
appinsights = { version = "0.2.2", default-features = false, features = ["rustls"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
uuid = { version = "0.8", features = ["serde", "v4"] }
|
uuid = { version = "0.8", features = ["serde", "v4"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
@ -24,4 +20,4 @@ z3-sys = { version = "0.6", optional = true}
|
|||||||
iced-x86 = { version = "1.17", optional = true}
|
iced-x86 = { version = "1.17", optional = true}
|
||||||
tokio = { version = "1.16", features = ["full"] }
|
tokio = { version = "1.16", features = ["full"] }
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
chrono = "0.4"
|
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||||
|
@ -67,7 +67,7 @@ impl fmt::Display for InstanceTelemetryKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type TelemetryClient = appinsights::TelemetryClient<appinsights::InMemoryChannel>;
|
pub type TelemetryClient = appinsights::TelemetryClient;
|
||||||
pub enum ClientType {
|
pub enum ClientType {
|
||||||
Instance,
|
Instance,
|
||||||
Microsoft,
|
Microsoft,
|
||||||
@ -450,7 +450,10 @@ mod global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const REDACTED: &str = "Redacted";
|
const REDACTED: &str = "Redacted";
|
||||||
pub fn set_appinsights_clients(
|
// This function doesn't do anything async, but TelemetryClient::new must be invoked
|
||||||
|
// upon a Tokio runtime task, since it calls Tokio::spawn. The easiest way to ensure this
|
||||||
|
// statically is to make this function async.
|
||||||
|
pub async fn set_appinsights_clients(
|
||||||
instance_key: Option<InstanceTelemetryKey>,
|
instance_key: Option<InstanceTelemetryKey>,
|
||||||
microsoft_key: Option<MicrosoftTelemetryKey>,
|
microsoft_key: Option<MicrosoftTelemetryKey>,
|
||||||
) {
|
) {
|
||||||
@ -481,12 +484,11 @@ pub fn set_appinsights_clients(
|
|||||||
/// Meant for a final attempt at flushing pending items before an abnormal exit.
|
/// Meant for a final attempt at flushing pending items before an abnormal exit.
|
||||||
/// After calling this function, any existing telemetry client will be dropped,
|
/// After calling this function, any existing telemetry client will be dropped,
|
||||||
/// and subsequent telemetry submission will be a silent no-op.
|
/// and subsequent telemetry submission will be a silent no-op.
|
||||||
pub fn try_flush_and_close() {
|
pub async fn try_flush_and_close() {
|
||||||
let clients = global::take_clients();
|
let clients = global::take_clients();
|
||||||
|
|
||||||
for client in clients {
|
for client in clients {
|
||||||
client.flush_channel();
|
client.close_channel().await;
|
||||||
client.close_channel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dropping the broadcast sender to make sure all pending events are sent
|
// dropping the broadcast sender to make sure all pending events are sent
|
||||||
|
@ -46,16 +46,9 @@ if [ X${CARGO_INCREMENTAL} == X ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cargo fmt -- --check
|
cargo fmt -- --check
|
||||||
# RUSTSEC-2020-0016: a dependency `net2` (pulled in from tokio) is deprecated
|
|
||||||
# RUSTSEC-2020-0036: a dependency `failure` (pulled from proc-maps) is deprecated
|
|
||||||
# RUSTSEC-2019-0036: a dependency `failure` (pulled from proc-maps) has type confusion vulnerability
|
|
||||||
# RUSTSEC-2021-0065: a dependency `anymap` is no longer maintained
|
|
||||||
# RUSTSEC-2020-0077: `memmap` dependency unmaintained, via `symbolic` (see: `getsentry/symbolic#304`)
|
|
||||||
# RUSTSEC-2020-0159: potential segfault in `time`, not yet patched (#1366)
|
|
||||||
# RUSTSEC-2020-0071: potential segfault in `chrono`, not yet patched (#1366)
|
|
||||||
# RUSTSEC-2022-0048: xml-rs is unmaintained
|
# RUSTSEC-2022-0048: xml-rs is unmaintained
|
||||||
# RUSTSEC-2021-0139: ansi_term is unmaintained
|
# RUSTSEC-2021-0139: ansi_term is unmaintained
|
||||||
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2020-0036 --ignore RUSTSEC-2019-0036 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2020-0077 --ignore RUSTSEC-2022-0048 --ignore RUSTSEC-2021-0139
|
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2022-0048 --ignore RUSTSEC-2021-0139
|
||||||
cargo-license -j > data/licenses.json
|
cargo-license -j > data/licenses.json
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
cargo clippy --release --locked --all-targets -- -D warnings
|
cargo clippy --release --locked --all-targets -- -D warnings
|
||||||
|
@ -12,13 +12,9 @@ mkdir -p artifacts/proxy
|
|||||||
cd src/proxy-manager
|
cd src/proxy-manager
|
||||||
cargo fmt -- --check
|
cargo fmt -- --check
|
||||||
cargo clippy --release --all-targets -- -D warnings
|
cargo clippy --release --all-targets -- -D warnings
|
||||||
# RUSTSEC-2020-0016: a dependency `net2` (pulled in from `tokio`) is deprecated
|
|
||||||
# RUSTSEC-2021-0065: a dependency `anymap` is no longer supported
|
|
||||||
# RUSTSEC-2020-0159: potential segfault in `time`, not yet patched (#1366)
|
|
||||||
# RUSTSEC-2020-0071: potential segfault in `chrono`, not yet patched (#1366)
|
|
||||||
# RUSTSEC-2022-0048: xml-rs is unmaintained
|
# RUSTSEC-2022-0048: xml-rs is unmaintained
|
||||||
# RUSTSEC-2021-0139: ansi_term is unmaintained
|
# RUSTSEC-2021-0139: ansi_term is unmaintained
|
||||||
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2022-0048 --ignore RUSTSEC-2021-0139
|
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2022-0048 --ignore RUSTSEC-2021-0139
|
||||||
cargo-license -j > data/licenses.json
|
cargo-license -j > data/licenses.json
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
# export RUST_LOG=trace
|
# export RUST_LOG=trace
|
||||||
|
@ -871,7 +871,7 @@ class TestOnefuzz:
|
|||||||
# about errors
|
# about errors
|
||||||
if (
|
if (
|
||||||
entry.get("severityLevel") == 2
|
entry.get("severityLevel") == 2
|
||||||
and entry.get("sdkVersion") == "rust:0.1.5"
|
and "rust" in entry.get("sdkVersion")
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -897,7 +897,7 @@ class TestOnefuzz:
|
|||||||
if (
|
if (
|
||||||
"storage queue pop failed" in message
|
"storage queue pop failed" in message
|
||||||
or "storage queue delete failed" in message
|
or "storage queue delete failed" in message
|
||||||
) and entry.get("sdkVersion") == "rust:0.1.5":
|
) and ("rust" in entry.get("sdkVersion")):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if message is None:
|
if message is None:
|
||||||
|
46
src/proxy-manager/Cargo.lock
generated
46
src/proxy-manager/Cargo.lock
generated
@ -28,11 +28,14 @@ checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "appinsights"
|
name = "appinsights"
|
||||||
version = "0.1.5"
|
version = "0.2.2"
|
||||||
source = "git+https://github.com/dmolokanov/appinsights-rs?rev=0af6ec83bad1c050160f5258ab08e9834596ce20#0af6ec83bad1c050160f5258ab08e9834596ce20"
|
source = "git+https://github.com/Porges/appinsights-rs?branch=audit-fixes#8264e0236c7a2729c4af4a2ba0017ca0270d7d0e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
"chrono",
|
"chrono",
|
||||||
"crossbeam-channel",
|
"crossbeam-queue",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-util",
|
||||||
"hostname",
|
"hostname",
|
||||||
"http",
|
"http",
|
||||||
"log",
|
"log",
|
||||||
@ -41,6 +44,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sm",
|
"sm",
|
||||||
|
"tokio",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -106,9 +110,9 @@ checksum = "d9df67f7bf9ef8498769f994239c45613ef0c5899415fb58e9add412d2c1a538"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.1.0"
|
version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@ -127,14 +131,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.19"
|
version = "0.4.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
checksum = "6127248204b9aba09a362f6c930ef6a78f2c1b2215f8a7b398c06e1083f17af0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"js-sys",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"time",
|
"wasm-bindgen",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -170,10 +174,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
|
checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-channel"
|
name = "crossbeam-queue"
|
||||||
version = "0.5.1"
|
version = "0.3.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
|
checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
@ -945,9 +949,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.5.5"
|
version = "1.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
|
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@ -956,9 +960,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.6.25"
|
version = "0.6.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "remove_dir_all"
|
name = "remove_dir_all"
|
||||||
@ -1361,16 +1365,6 @@ dependencies = [
|
|||||||
"syn 1.0.76",
|
"syn 1.0.76",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.1.43"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
|
@ -22,3 +22,6 @@ reqwest-retry = { path = "../agent/reqwest-retry"}
|
|||||||
onefuzz-telemetry = { path = "../agent/onefuzz-telemetry" }
|
onefuzz-telemetry = { path = "../agent/onefuzz-telemetry" }
|
||||||
uuid = "0.8"
|
uuid = "0.8"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
appinsights = { git = "https://github.com/Porges/appinsights-rs", branch="audit-fixes" }
|
||||||
|
@ -69,7 +69,7 @@ pub struct Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn from_file(path: String) -> Result<Self> {
|
pub async fn from_file(path: String) -> Result<Self> {
|
||||||
let config_path = PathBuf::from(&path);
|
let config_path = PathBuf::from(&path);
|
||||||
|
|
||||||
let f = File::open(&config_path).map_err(|source| ProxyError::FileError { source })?;
|
let f = File::open(&config_path).map_err(|source| ProxyError::FileError { source })?;
|
||||||
@ -80,7 +80,8 @@ impl Config {
|
|||||||
set_appinsights_clients(
|
set_appinsights_clients(
|
||||||
data.instance_telemetry_key.clone(),
|
data.instance_telemetry_key.clone(),
|
||||||
data.microsoft_telemetry_key.clone(),
|
data.microsoft_telemetry_key.clone(),
|
||||||
);
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
onefuzz_telemetry::set_property(EventData::Region(data.region.to_owned()));
|
onefuzz_telemetry::set_property(EventData::Region(data.region.to_owned()));
|
||||||
onefuzz_telemetry::set_property(EventData::Version(env!("ONEFUZZ_VERSION").to_string()));
|
onefuzz_telemetry::set_property(EventData::Version(env!("ONEFUZZ_VERSION").to_string()));
|
||||||
|
@ -46,7 +46,7 @@ async fn run(proxy_config: Config) -> Result<()> {
|
|||||||
if let Err(err) = &result {
|
if let Err(err) = &result {
|
||||||
error!("run loop failed: {:?}", err);
|
error!("run loop failed: {:?}", err);
|
||||||
}
|
}
|
||||||
onefuzz_telemetry::try_flush_and_close();
|
onefuzz_telemetry::try_flush_and_close().await;
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,9 +82,10 @@ fn main() -> Result<()> {
|
|||||||
.value_of("config")
|
.value_of("config")
|
||||||
.ok_or_else(|| MissingArg("--config".to_string()))?
|
.ok_or_else(|| MissingArg("--config".to_string()))?
|
||||||
.parse()?;
|
.parse()?;
|
||||||
let proxy = Config::from_file(config_path)?;
|
|
||||||
|
|
||||||
info!("parsed initial config");
|
|
||||||
let rt = Runtime::new()?;
|
let rt = Runtime::new()?;
|
||||||
|
let proxy = rt.block_on(Config::from_file(config_path))?;
|
||||||
|
info!("parsed initial config");
|
||||||
|
|
||||||
rt.block_on(run(proxy))
|
rt.block_on(run(proxy))
|
||||||
}
|
}
|
||||||
|
150
src/utils/telemetry-stats/Cargo.lock
generated
150
src/utils/telemetry-stats/Cargo.lock
generated
@ -1,5 +1,16 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android_system_properties"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.38"
|
version = "1.0.38"
|
||||||
@ -13,16 +24,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "bumpalo"
|
||||||
version = "0.4.19"
|
version = "3.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"iana-time-zone",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"serde",
|
"serde",
|
||||||
"time",
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone"
|
||||||
|
version = "0.1.46"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ad2bfd338099682614d3ee3fe0cd72e0b6a41ca6a87f6a74a3bd593c91650501"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -33,10 +74,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "js-sys"
|
||||||
version = "0.2.84"
|
version = "0.3.59"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1cca32fa0182e8c0989459524dc356b8f2b5c10f1b9eb521b7d182c03cf8c5ff"
|
checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2"
|
||||||
|
dependencies = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.132"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
@ -57,6 +116,12 @@ dependencies = [
|
|||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.13.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "onefuzz-telemetry-stats"
|
name = "onefuzz-telemetry-stats"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -124,26 +189,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.60"
|
version = "1.0.67"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
|
checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.1.44"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"wasi",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
@ -151,10 +205,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasm-bindgen"
|
||||||
version = "0.10.0+wasi-snapshot-preview1"
|
version = "0.2.82"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-backend"
|
||||||
|
version = "0.2.82"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"log",
|
||||||
|
"once_cell",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.82"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.82"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-backend",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.82"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
|
@ -9,4 +9,4 @@ license = "MIT"
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
chrono = { version = "0.4", features = ["serde"] }
|
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }
|
||||||
|
Reference in New Issue
Block a user