Skip to content

Commit 0c67990

Browse files
committed
test(network): name proxy contracts by behavior
Signed-off-by: John Myers <[email protected]>
1 parent 5ab776f commit 0c67990

7 files changed

Lines changed: 37 additions & 37 deletions

File tree

‎crates/openshell-sandbox/src/lib.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,9 +4041,9 @@ filesystem_policy:
40414041
assert_eq!(config["unmapped"]["previous_policy_active"], true);
40424042
assert!(
40434043
config["message"]
4044-
.as_str()
4045-
.unwrap()
4046-
.contains("previous policy IS active")
4047-
);
4044+
.as_str()
4045+
.unwrap()
4046+
.contains("previous policy IS active")
4047+
);
40484048
}
40494049
}

‎crates/openshell-sandbox/src/metadata_server.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ mod tests {
175175
}
176176

177177
#[tokio::test]
178-
async fn phase0_metadata_loopback_dispatches_method_path_and_response() {
178+
async fn metadata_loopback_dispatches_method_path_and_response() {
179179
let (requests_tx, mut requests_rx) = mpsc::unbounded_channel();
180180
let handler = RecordingHandler {
181181
requests: requests_tx,
@@ -202,7 +202,7 @@ mod tests {
202202
}
203203

204204
#[tokio::test]
205-
async fn phase0_metadata_loopback_rejects_oversized_headers_before_handler() {
205+
async fn metadata_loopback_rejects_oversized_headers_before_handler() {
206206
let (requests_tx, mut requests_rx) = mpsc::unbounded_channel();
207207
let handler = RecordingHandler {
208208
requests: requests_tx,

‎crates/openshell-supervisor-network/src/opa.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5283,7 +5283,7 @@ process:
52835283
}
52845284

52855285
#[test]
5286-
fn phase0_overlapping_policy_outputs_are_snapshotted_independently() {
5286+
fn overlapping_policy_outputs_are_snapshotted_independently() {
52875287
let engine = OpaEngine::from_strings(TEST_POLICY, OVERLAPPING_L7_TEST_DATA)
52885288
.expect("engine should load overlapping data");
52895289
let input = NetworkInput {

‎crates/openshell-supervisor-network/src/proxy.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4945,7 +4945,7 @@ network_policies: {}
49454945
}
49464946

49474947
#[test]
4948-
fn forward_policy_denial_ocsf_includes_validation_rationale() {
4948+
fn forward_policy_denial_ocsf_includes_validation_rationale() {
49494949
let reason = "policy validation failed; fail-closed quarantine is active; candidate version 7 rejected: conflicting tls metadata";
49504950
let event = build_forward_policy_deny_ocsf_event(
49514951
"127.0.0.1:45123".parse().unwrap(),
@@ -4961,10 +4961,10 @@ network_policies: {}
49614961
);
49624962
let json = event.to_json().unwrap();
49634963

4964-
assert_eq!(json["status_detail"], reason);
4965-
assert_eq!(json["action"], "Denied");
4966-
assert_eq!(json["disposition"], "Blocked");
4967-
}
4964+
assert_eq!(json["status_detail"], reason);
4965+
assert_eq!(json["action"], "Denied");
4966+
assert_eq!(json["disposition"], "Blocked");
4967+
}
49684968

49694969
#[test]
49704970
fn endpoint_only_opa_allows_declared_endpoint_without_process_identity() {
@@ -9762,6 +9762,6 @@ network_policies:
97629762
}
97639763
}
97649764

9765-
#[path = "phase0.rs"]
9766-
mod phase0;
9765+
#[path = "compatibility.rs"]
9766+
mod compatibility;
97679767
}

‎crates/openshell-supervisor-network/src/proxy/destination.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ mod tests {
246246
}
247247

248248
#[test]
249-
fn phase0_validation_mode_precedence_is_explicit_and_stable() {
249+
fn validation_mode_precedence_is_explicit_and_stable() {
250250
let trusted_ip = IpAddr::V4(Ipv4Addr::new(169, 254, 1, 2));
251251
let trusted = build_validation_plan(
252252
"host.openshell.internal",

crates/openshell-supervisor-network/src/proxy/tests/phase0.rs renamed to crates/openshell-supervisor-network/src/proxy/tests/compatibility.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
//! Compatibility fixtures for RFC 0005 Phase 0.
4+
//! Compatibility and regression contracts for the shared proxy egress pipeline.
55
66
use super::*;
77
use std::io::Write;
@@ -27,7 +27,7 @@ fn allowed_decision(intent: EgressIntent) -> EgressDecision {
2727
EgressDecision {
2828
intent,
2929
action: NetworkAction::Allow {
30-
matched_policy: Some("phase0".to_string()),
30+
matched_policy: Some("proxy_compatibility".to_string()),
3131
},
3232
l4_policy_generation: 0,
3333
identity: ProcessIdentityEvidence::Available,
@@ -98,7 +98,7 @@ async fn destination_denials_preserve_adapter_specific_wire_contracts() {
9898
for (kind, detail) in cases {
9999
let denial = DestinationDenial {
100100
kind,
101-
reason: "phase0 destination failure".to_string(),
101+
reason: "proxy compatibility destination failure".to_string(),
102102
};
103103
let peer: SocketAddr = "127.0.0.1:41000".parse().unwrap();
104104

@@ -142,7 +142,7 @@ async fn destination_denials_preserve_adapter_specific_wire_contracts() {
142142
"42",
143143
"/usr/bin/sh",
144144
"curl",
145-
"phase0",
145+
"proxy_compatibility",
146146
&allowed_decision(EgressIntent::forward_http(
147147
"target.example".to_string(),
148148
8080,
@@ -213,7 +213,7 @@ fn representative_adapter_denials_preserve_ocsf_fields() {
213213
"42",
214214
"/usr/bin/sh",
215215
"curl --proxy",
216-
"phase0",
216+
"proxy_compatibility",
217217
&allowed_decision(EgressIntent::forward_http(
218218
"target.example".to_string(),
219219
8080,
@@ -263,7 +263,7 @@ fn representative_adapter_denials_preserve_ocsf_fields() {
263263
assert_eq!(forward["dst_endpoint"]["domain"], "target.example");
264264
assert_eq!(forward["dst_endpoint"]["port"], 8080);
265265
assert_eq!(forward["http_request"]["http_method"], "POST");
266-
assert_eq!(forward["firewall_rule"]["name"], "phase0");
266+
assert_eq!(forward["firewall_rule"]["name"], "proxy_compatibility");
267267
assert_eq!(forward["firewall_rule"]["type"], "ssrf");
268268
assert_eq!(
269269
forward["message"],
@@ -283,7 +283,7 @@ fn representative_adapter_allows_preserve_ocsf_fields() {
283283
"42",
284284
"/usr/bin/sh",
285285
"curl --proxy",
286-
"phase0",
286+
"proxy_compatibility",
287287
true,
288288
))
289289
.unwrap();
@@ -296,7 +296,7 @@ fn representative_adapter_allows_preserve_ocsf_fields() {
296296
assert_eq!(connect["dst_endpoint"]["domain"], "target.example");
297297
assert_eq!(connect["dst_endpoint"]["port"], 8443);
298298
assert_eq!(connect["actor"]["process"]["name"], "/usr/bin/curl");
299-
assert_eq!(connect["firewall_rule"]["name"], "phase0");
299+
assert_eq!(connect["firewall_rule"]["name"], "proxy_compatibility");
300300
assert_eq!(connect["firewall_rule"]["type"], "opa");
301301
assert_eq!(connect["message"], "CONNECT_L7 allowed target.example:8443");
302302

@@ -310,7 +310,7 @@ fn representative_adapter_allows_preserve_ocsf_fields() {
310310
"42",
311311
"/usr/bin/sh",
312312
"curl --proxy",
313-
"phase0",
313+
"proxy_compatibility",
314314
))
315315
.unwrap();
316316
assert_eq!(forward["class_name"], "HTTP Activity");
@@ -322,7 +322,7 @@ fn representative_adapter_allows_preserve_ocsf_fields() {
322322
assert_eq!(forward["dst_endpoint"]["domain"], "target.example");
323323
assert_eq!(forward["dst_endpoint"]["port"], 8080);
324324
assert_eq!(forward["http_request"]["http_method"], "GET");
325-
assert_eq!(forward["firewall_rule"]["name"], "phase0");
325+
assert_eq!(forward["firewall_rule"]["name"], "proxy_compatibility");
326326
assert_eq!(forward["firewall_rule"]["type"], "opa");
327327
assert_eq!(
328328
forward["message"],
@@ -335,8 +335,8 @@ fn poisoned_engine() -> OpaEngine {
335335
include_str!("../../../data/sandbox-policy.rego"),
336336
r#"
337337
network_policies:
338-
phase0:
339-
name: phase0
338+
proxy_compatibility:
339+
name: proxy_compatibility
340340
endpoints:
341341
- host: target.example
342342
port: 443
@@ -397,8 +397,8 @@ fn identity_required_policy_accepts_real_binary_and_rejects_empty_exec_path() {
397397
include_str!("../../../data/sandbox-policy.rego"),
398398
r#"
399399
network_policies:
400-
phase0:
401-
name: phase0
400+
proxy_compatibility:
401+
name: proxy_compatibility
402402
endpoints:
403403
- host: target.example
404404
port: 443
@@ -524,7 +524,7 @@ async fn exercise_benchmark_request(proxy_addr: SocketAddr, target: SocketAddr,
524524
format!("CONNECT {authority} HTTP/1.1\r\nHost: {authority}\r\n\r\n")
525525
} else {
526526
format!(
527-
"GET http://{authority}/phase0 HTTP/1.1\r\nHost: {authority}\r\nConnection: close\r\n\r\n"
527+
"GET http://{authority}/proxy-baseline HTTP/1.1\r\nHost: {authority}\r\nConnection: close\r\n\r\n"
528528
)
529529
};
530530
client.write_all(request.as_bytes()).await.unwrap();
@@ -534,10 +534,10 @@ async fn exercise_benchmark_request(proxy_addr: SocketAddr, target: SocketAddr,
534534
}
535535

536536
/// Run with:
537-
/// `cargo test -p openshell-supervisor-network phase0_proxy_performance_baseline -- --ignored --nocapture --test-threads=1`
537+
/// `cargo test -p openshell-supervisor-network proxy_performance_baseline -- --ignored --nocapture --test-threads=1`
538538
#[test]
539-
#[ignore = "manual Phase 0 allocation/query/latency baseline"]
540-
fn phase0_proxy_performance_baseline() {
539+
#[ignore = "manual proxy allocation/query/latency baseline"]
540+
fn proxy_performance_baseline() {
541541
temp_env::with_vars(
542542
[(
543543
openshell_core::sandbox_env::NETWORK_BINARY_IDENTITY,
@@ -559,8 +559,8 @@ fn phase0_proxy_performance_baseline() {
559559
let policy = format!(
560560
r#"
561561
network_policies:
562-
phase0:
563-
name: phase0
562+
proxy_compatibility:
563+
name: proxy_compatibility
564564
endpoints:
565565
- host: {host}
566566
port: {port}
@@ -642,7 +642,7 @@ network_policies:
642642
"{}",
643643
serde_json::json!({
644644
"iterations": iterations,
645-
"phase0_proxy_baseline": results,
645+
"proxy_performance_baseline": results,
646646
"scenario": "declared_loopback_destination_denied",
647647
"schema_version": 1,
648648
})

‎crates/openshell-supervisor-process/src/bypass_monitor/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ mod tests {
496496
}
497497

498498
#[test]
499-
fn phase0_bypass_ocsf_contract_is_stable() {
499+
fn bypass_ocsf_contract_is_stable() {
500500
let event = BypassEvent {
501501
dst_addr: "93.184.216.34".to_string(),
502502
dst_port: 443,

0 commit comments

Comments
 (0)