Skip to content

Commit bb4012d

Browse files
committed
fix(ffe): isolate malformed flag configurations
1 parent 3ef1113 commit bb4012d

9 files changed

Lines changed: 83 additions & 36 deletions

File tree

Cargo.lock

Lines changed: 38 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ inherits = "release"
4141
# #2253 consolidated `anyhow`, `serde`, `tokio` and `tracing` to the workspace
4242
# level, so they are mirrored here too.
4343
[workspace.dependencies]
44+
allocator-api2 = { version = "0.2.21", default-features = false }
4445
anyhow = { version = "1.0", default-features = false }
4546
arc-swap = "1.7.1"
47+
bolero = { version = "0.13.4", default-features = false }
48+
chrono = { version = "0.4.38", default-features = false }
49+
clap = { version = "4.3.21", default-features = false }
50+
criterion = { version = "0.5.1", default-features = true }
51+
cxx-build = { version = "1.0", default-features = false }
52+
elf = { version = "0.7", default-features = false }
53+
futures = { version = "0.3", default-features = false }
4654
hyper = { version = "1.6", features = [
4755
"http1",
4856
"client",
@@ -52,12 +60,20 @@ hyper-util = { version = "0.1.10", features = [
5260
"client",
5361
"client-legacy",
5462
] }
63+
io-lifetimes = { version = "1.0", default-features = false }
64+
libc = { version = "0.2", default-features = true }
5565
prost-build = { version = "0.14.1", default-features = false }
5666
protoc-bin-vendored = { version = "3.0.0", default-features = false }
67+
rustls = { version = "0.23", default-features = false }
5768
serde = { version = "1.0", default-features = false }
5869
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
70+
syn = { version = "^2", default-features = false }
71+
tempfile = { version = "3.13", default-features = false, features = [
72+
"getrandom",
73+
] }
5974
tokio = { version = "1.36", default-features = false }
6075
tracing = { version = "0.1", default-features = false }
76+
uuid = { version = "1.7.0", default-features = false }
6177

6278
[workspace.lints]
6379
# empty for compat with libdatadog

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ RUN_TESTS_CMD := DD_SERVICE= DD_ENV= REPORT_EXIT_STATUS=1 TEST_PHP_SRCDIR=$(PROJ
4848

4949
C_FILES = $(shell find components components-rs ext src/dogstatsd tracer zend_abstract_interface -name '*.c' -o -name '*.h' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' )
5050
TEST_FILES = $(shell find tests/ext -name '*.php*' -o -name '*.inc' -o -name '*.json' -o -name '*.yaml' -o -name 'CONFLICTS' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' )
51-
RUST_FILES = $(BUILD_DIR)/Cargo.toml $(BUILD_DIR)/Cargo.lock $(shell find components-rs -name '*.c' -o -name '*.rs' -o -name 'Cargo.toml' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) $(shell find libdatadog/{build-common,datadog-ffe,datadog-ipc,datadog-ipc-macros,datadog-live-debugger,datadog-live-debugger-ffi,libdd-remote-config,datadog-sidecar,datadog-sidecar-ffi,datadog-sidecar-macros,libdd-alloc,libdd-capabilities,libdd-capabilities-impl,libdd-common,libdd-common-ffi,libdd-crashtracker,libdd-crashtracker-ffi,libdd-data-pipeline,libdd-ddsketch,libdd-dogstatsd-client,libdd-library-config,libdd-library-config-ffi,libdd-log,libdd-shared-runtime,libdd-telemetry,libdd-telemetry-ffi,libdd-tinybytes,libdd-trace-*,spawn_worker,tools/{cc_utils,sidecar_mockgen},libdd-trace-*,Cargo.toml} \( -type l -o -type f \) \( -path "*/src*" -o -path "*/examples*" -o -path "*Cargo.toml" -o -path "*/build.rs" -o -path "*/tests/dataservice.rs" -o -path "*/tests/service_functional.rs" \) -not -path "*/datadog-ipc/build.rs" -not -path "*/datadog-sidecar-ffi/build.rs")
51+
RUST_FILES = $(BUILD_DIR)/Cargo.toml $(BUILD_DIR)/Cargo.lock $(shell find components-rs -name '*.c' -o -name '*.rs' -o -name 'Cargo.toml' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) $(shell find libdatadog/{build-common,libdd-ffe,datadog-ipc,datadog-ipc-macros,datadog-live-debugger,datadog-live-debugger-ffi,libdd-remote-config,datadog-sidecar,datadog-sidecar-ffi,datadog-sidecar-macros,libdd-alloc,libdd-capabilities,libdd-capabilities-impl,libdd-common,libdd-common-ffi,libdd-crashtracker,libdd-crashtracker-ffi,libdd-data-pipeline,libdd-ddsketch,libdd-dogstatsd-client,libdd-library-config,libdd-library-config-ffi,libdd-log,libdd-shared-runtime,libdd-telemetry,libdd-telemetry-ffi,libdd-tinybytes,libdd-trace-*,spawn_worker,tools/{cc_utils,sidecar_mockgen},libdd-trace-*,Cargo.toml} \( -type l -o -type f \) \( -path "*/src*" -o -path "*/examples*" -o -path "*Cargo.toml" -o -path "*/build.rs" -o -path "*/tests/dataservice.rs" -o -path "*/tests/service_functional.rs" \) -not -path "*/datadog-ipc/build.rs" -not -path "*/datadog-sidecar-ffi/build.rs")
5252
ALL_OBJECT_FILES = $(C_FILES) $(RUST_FILES) $(BUILD_DIR)/Makefile
5353
TEST_OPCACHE_FILES = $(shell find tests/opcache -name '*.php*' -o -name '.gitkeep' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' )
5454
TEST_STUB_FILES = $(shell find tests/ext -type d -name 'stubs' -exec find '{}' -type f \; | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' )

components-rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ libdd-telemetry-ffi = { path = "../libdatadog/libdd-telemetry-ffi", default-feat
1515
datadog-live-debugger = { path = "../libdatadog/datadog-live-debugger" }
1616
datadog-live-debugger-ffi = { path = "../libdatadog/datadog-live-debugger-ffi", default-features = false }
1717
datadog-ipc = { path = "../libdatadog/datadog-ipc" }
18-
datadog-ffe = { path = "../libdatadog/datadog-ffe" }
18+
datadog-ffe = { package = "libdd-ffe", path = "../libdatadog/libdd-ffe" }
1919
libdd-remote-config = { path = "../libdatadog/libdd-remote-config" }
2020
datadog-sidecar = { path = "../libdatadog/datadog-sidecar" }
2121
datadog-sidecar-ffi = { path = "../libdatadog/datadog-sidecar-ffi" }

components-rs/remote_config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ pub unsafe extern "C" fn ddog_init_remote_config(flags: RemoteConfigFlags) {
164164
}
165165

166166
if live_debugging_enabled {
167-
DATADOG_REMOTE_CONFIG_PRODUCTS.push(RemoteConfigProduct::LiveDebugger)
167+
DATADOG_REMOTE_CONFIG_PRODUCTS.push(RemoteConfigProduct::LiveDebugging)
168168
}
169169

170170
if appsec_config {
171171
DATADOG_REMOTE_CONFIG_PRODUCTS.push(RemoteConfigProduct::AsmData);
172-
DATADOG_REMOTE_CONFIG_PRODUCTS.push(RemoteConfigProduct::AsmDD);
172+
DATADOG_REMOTE_CONFIG_PRODUCTS.push(RemoteConfigProduct::AsmDd);
173173
DATADOG_REMOTE_CONFIG_PRODUCTS.push(RemoteConfigProduct::Asm);
174174
[
175175
RemoteConfigCapabilities::AsmIpBlocking,
@@ -390,7 +390,7 @@ pub extern "C" fn ddog_process_remote_configs(remote_config: &mut RemoteConfigSt
390390
} => {
391391
if let Some(data) = value.data {
392392
match value.product {
393-
RemoteConfigProduct::LiveDebugger => {
393+
RemoteConfigProduct::LiveDebugging => {
394394
let val = Box::new((data, MaybeShmLimiter::open(limiter_index)));
395395
let rc_ref: &mut RemoteConfigState = unsafe { mem::transmute(remote_config as *mut _) }; // sigh, borrow checker
396396
let config_id = value.config_id.clone();
@@ -439,7 +439,7 @@ pub extern "C" fn ddog_process_remote_configs(remote_config: &mut RemoteConfigSt
439439
}
440440
}
441441
RemoteConfigUpdate::Remove(path) => match path.product {
442-
RemoteConfigProduct::LiveDebugger => {
442+
RemoteConfigProduct::LiveDebugging => {
443443
if let Some(boxed) = remote_config.live_debugger.active.remove(&path.config_id) {
444444
if let Some(debugger) = boxed.0.downcast::<LiveDebuggingData>() {
445445
remove_config(remote_config, &path.config_id, debugger);
@@ -755,7 +755,7 @@ pub extern "C" fn ddog_rshutdown_remote_config(remote_config: &mut RemoteConfigS
755755
remote_config.dynamic_config.merged_configs.clear();
756756
remote_config.manager.unload_configs(&[
757757
RemoteConfigProduct::ApmTracing,
758-
RemoteConfigProduct::LiveDebugger,
758+
RemoteConfigProduct::LiveDebugging,
759759
]);
760760
}
761761

components-rs/telemetry.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ pub unsafe extern "C" fn ddog_sidecar_telemetry_addIntegration_buffer(
105105
version,
106106
compatible: None,
107107
auto_enabled: None,
108+
error: None,
108109
});
109110
buffer.buffer.push(SidecarAction::Telemetry(action));
110111
}
@@ -121,6 +122,8 @@ pub unsafe extern "C" fn ddog_sidecar_telemetry_addDependency_buffer(
121122
let action = TelemetryActions::AddDependency(Dependency {
122123
name: dependency_name.to_utf8_lossy().into_owned(),
123124
version,
125+
hash: None,
126+
metadata: None,
124127
});
125128
buffer.buffer.push(SidecarAction::Telemetry(action));
126129
}
@@ -139,6 +142,9 @@ pub unsafe extern "C" fn ddog_sidecar_telemetry_addEndpoint_buffer(
139142
path: Some(path.to_utf8_lossy().into_owned()),
140143
operation_name: operation_name.to_utf8_lossy().into_owned(),
141144
resource_name: resource_name.to_utf8_lossy().into_owned(),
145+
request_body_type: None,
146+
response_body_type: None,
147+
response_code: None,
142148
});
143149
buffer.buffer.push(SidecarAction::Telemetry(action));
144150
}
@@ -158,7 +164,7 @@ pub unsafe extern "C" fn ddog_sidecar_telemetry_enqueueConfig_buffer(
158164
};
159165
let action = TelemetryActions::AddConfig(data::Configuration {
160166
name: config_key.to_utf8_lossy().into_owned(),
161-
value: config_value.to_utf8_lossy().into_owned(),
167+
value: Some(config_value.to_utf8_lossy().into_owned()),
162168
origin,
163169
config_id,
164170
seq_id: None,

libdatadog

Submodule libdatadog updated 214 files

tests/ext/ffe/system_test_data_evaluate.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ function run_fixture_case($client, $fileName, $index, array $case, array &$failu
175175
. ': value got=' . encode_value($details->getValue())
176176
. ' want=' . encode_value($case['result']['value']);
177177
}
178+
179+
if ($details->getReason() !== $case['result']['reason']) {
180+
$failures[] = $fileName . '#' . $index
181+
. ': reason got=' . encode_value($details->getReason())
182+
. ' want=' . encode_value($case['result']['reason']);
183+
}
184+
185+
if (array_key_exists('errorCode', $case['result'])
186+
&& $details->getErrorCode() !== $case['result']['errorCode']) {
187+
$failures[] = $fileName . '#' . $index
188+
. ': errorCode got=' . encode_value($details->getErrorCode())
189+
. ' want=' . encode_value($case['result']['errorCode']);
190+
}
178191
}
179192

180193
function evaluate_fixture_case($client, $variationType, $flag, $defaultValue, array $context)

0 commit comments

Comments
 (0)