Repository navigation
fix: route captured network decisions through Tessera #1419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7329141
cb56033
c26bae6
764d732
cc9cbff
4ce4047
8a693f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,7 +17,7 @@ use crate::process_security_environment_spec::process_security_environment_layou | |||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| use crate::process_container_common::network_policy_helpers::{ | ||||||||||||||
| add_default_network_capabilities, ensure_capability, | ||||||||||||||
| add_default_network_capabilities, ensure_capability, INTERNET_CLIENT_CAPABILITY, | ||||||||||||||
| }; | ||||||||||||||
| use crate::process_container_common::secenv::SecurityEnvironmentVersion; | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -31,13 +31,14 @@ pub(super) fn build_psec_v1_security_environment_spec( | |||||||||||||
| request: &ExecutionRequest, | ||||||||||||||
| version: SecurityEnvironmentVersion, | ||||||||||||||
| supports_network_ingress: bool, | ||||||||||||||
| capture_network_decisions: bool, | ||||||||||||||
| ) -> Vec<u8> { | ||||||||||||||
| assert_eq!( | ||||||||||||||
| version.major, 1, | ||||||||||||||
| "build_psec_v1_security_environment_spec only supports PSEC major version 1" | ||||||||||||||
| ); | ||||||||||||||
| let mut builder = flatbuffers::FlatBufferBuilder::with_capacity(1024); | ||||||||||||||
| let mut capabilities = effective_capabilities(&request.policy); | ||||||||||||||
| let mut capabilities = effective_capabilities(request, capture_network_decisions); | ||||||||||||||
| if request.policy.network_proxy.is_enabled() | ||||||||||||||
| && unrestricted_host_loopback_allowed(&request.policy) | ||||||||||||||
| { | ||||||||||||||
|
|
@@ -73,14 +74,28 @@ pub(super) fn build_psec_v1_security_environment_spec( | |||||||||||||
| builder.finished_data().to_vec() | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| fn effective_capabilities(policy: &ContainerPolicy) -> Vec<String> { | ||||||||||||||
| fn effective_capabilities( | ||||||||||||||
| request: &ExecutionRequest, | ||||||||||||||
| capture_network_decisions: bool, | ||||||||||||||
| ) -> Vec<String> { | ||||||||||||||
| let policy = &request.policy; | ||||||||||||||
| let mut capabilities: Vec<_> = policy | ||||||||||||||
| .capabilities | ||||||||||||||
| .iter() | ||||||||||||||
| .filter(|capability| !capability.is_empty()) | ||||||||||||||
| .cloned() | ||||||||||||||
| .collect(); | ||||||||||||||
| add_default_network_capabilities(policy, &mut capabilities); | ||||||||||||||
| if policy.capture_denials.is_some() | ||||||||||||||
| && capture_network_decisions | ||||||||||||||
| && policy.network_egress.is_some() | ||||||||||||||
|
richiemsft marked this conversation as resolved.
|
||||||||||||||
| && !policy.network_proxy.is_enabled() | ||||||||||||||
| { | ||||||||||||||
| // Let outbound attempts pass the capability gate so Tessera's egress | ||||||||||||||
| // policy makes and records the decision. Proxy mode must remain direct- | ||||||||||||||
| // egress denied and therefore deliberately omits internetClient. | ||||||||||||||
| ensure_capability(&mut capabilities, INTERNET_CLIENT_CAPABILITY); | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Medium (performance) β Measure the newly reachable high-cardinality capture path. Attribution: Network-heavy workloads may produce thousands of distinct groups for repeated connections to the same destination. This is an unmeasured CPU/teardown risk, not an unbounded-output claim or a merge condition. Fix: Benchmark a representative high-cardinality capture; if material, aggregate successfully decoded events by stable reason/endpoint fields or use a keyed structure while retaining detailed malformed-event diagnostics.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Measured in 8a693f0 with the new opt-in benchmark, documented in docs/development/build-and-test/pull-requests.md. Command from src: The benchmark calls the production post-TDH extractor/accumulator, using valid direct-default-deny events to the same TCP destination, and compares identical signatures against changing filter IDs and ephemeral local ports. Descending filter IDs exercise front-of-vector insertions. Results on this Windows x64 host with the pinned Rust 1.93 toolchain:
High-cardinality retention saturated at 4,096 groups, with one actionable destination denial and exact overflow accounting; the verbose JSON was 9,539,872 bytes at one million events. Document merge + pretty JSON writing took about 65 ms. The high-cardinality timings include fixture-property mutation, so the difference is not purely aggregator cost. I have kept the existing bounded diagnostic representation rather than adding an unproven keyed structure or dropping successfully decoded properties: the measured incremental cost is about 80 ms at the group bound and about 9% at one million events. This is a synthetic decoded-event measurement, not an end-to-end native capture benchmark: TDH decoding, ETL I/O, and native stop/close are explicitly excluded, so it does not establish OS teardown latency. |
||||||||||||||
| } | ||||||||||||||
| capabilities | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.