@@ -307,30 +307,6 @@ pub fn parse_l7_config(val: ®orus::Value) -> Option<L7EndpointConfig> {
307307
308308 let tls = match tls_value. as_str ( ) {
309309 "skip" => TlsMode :: Skip ,
310- "terminate" => {
311- let event = openshell_ocsf:: NetworkActivityBuilder :: new ( openshell_ocsf:: ctx:: ctx ( ) )
312- . activity ( openshell_ocsf:: ActivityId :: Other )
313- . severity ( openshell_ocsf:: SeverityId :: Medium )
314- . message (
315- "'tls: terminate' is deprecated; TLS termination is now automatic. \
316- Use 'tls: skip' to explicitly disable. This field will be removed in a future version.",
317- )
318- . build ( ) ;
319- openshell_ocsf:: ocsf_emit!( event) ;
320- TlsMode :: Auto
321- }
322- "passthrough" => {
323- let event = openshell_ocsf:: NetworkActivityBuilder :: new ( openshell_ocsf:: ctx:: ctx ( ) )
324- . activity ( openshell_ocsf:: ActivityId :: Other )
325- . severity ( openshell_ocsf:: SeverityId :: Medium )
326- . message (
327- "'tls: passthrough' is deprecated; TLS termination is now automatic. \
328- Use 'tls: skip' to explicitly disable. This field will be removed in a future version.",
329- )
330- . build ( ) ;
331- openshell_ocsf:: ocsf_emit!( event) ;
332- TlsMode :: Auto
333- }
334310 "" => TlsMode :: Auto ,
335311 _ => unreachable ! ( "endpoint modes were validated above" ) ,
336312 } ;
@@ -470,7 +446,6 @@ pub fn endpoint_path_matches(pattern: &str, path: &str) -> bool {
470446pub fn parse_tls_mode ( val : & regorus:: Value ) -> TlsMode {
471447 match get_object_str ( val, "tls" ) . as_deref ( ) {
472448 Some ( "skip" ) => TlsMode :: Skip ,
473- // "terminate" and "passthrough" are deprecated aliases (logged by parse_l7_config); fall through to Auto.
474449 _ => TlsMode :: Auto ,
475450 }
476451}
@@ -1273,6 +1248,12 @@ pub fn validate_l7_policies(data_json: &serde_json::Value) -> (Vec<String>, Vec<
12731248 ) ;
12741249 let loc = format ! ( "{name}.endpoints[{i}]" ) ;
12751250
1251+ errors. extend (
1252+ validate_endpoint_modes ( tls, enforcement, access)
1253+ . into_iter ( )
1254+ . map ( |reason| format ! ( "{loc}: {reason}" ) ) ,
1255+ ) ;
1256+
12761257 if protocol == "mcp" {
12771258 if host. trim ( ) . is_empty ( ) {
12781259 errors. push ( format ! (
@@ -1489,13 +1470,6 @@ pub fn validate_l7_policies(data_json: &serde_json::Value) -> (Vec<String>, Vec<
14891470 }
14901471 }
14911472
1492- // Deprecated tls values: warn but don't error
1493- if tls == "terminate" || tls == "passthrough" {
1494- warnings. push ( format ! (
1495- "{loc}: 'tls: {tls}' is deprecated; TLS termination is now automatic. Use 'tls: skip' to disable."
1496- ) ) ;
1497- }
1498-
14991473 // tls: skip with L7 on port 443 won't work
15001474 if tls == "skip" && !protocol. is_empty ( ) && ports. contains ( & 443 ) {
15011475 warnings. push ( format ! (
@@ -1510,10 +1484,6 @@ pub fn validate_l7_policies(data_json: &serde_json::Value) -> (Vec<String>, Vec<
15101484 ) ) ;
15111485 }
15121486
1513- // port 443 + rest + tls: skip — L7 won't work (already handled above)
1514- // The old warning about missing `tls: terminate` is no longer needed
1515- // because TLS termination is now automatic.
1516-
15171487 // Per-rule deny_rules validation (semantic checks handled by
15181488 // shared validator above).
15191489 if has_deny_rules {
@@ -1953,12 +1923,11 @@ mod tests {
19531923 #[ test]
19541924 fn parse_l7_config_rest_enforce ( ) {
19551925 let val = regorus:: Value :: from_json_str (
1956- r#"{"protocol": "rest", "tls": "terminate", " enforcement": "enforce", "host": "api.example.com", "port": 443}"# ,
1926+ r#"{"protocol": "rest", "enforcement": "enforce", "host": "api.example.com", "port": 443}"# ,
19571927 )
19581928 . unwrap ( ) ;
19591929 let config = parse_l7_config ( & val) . unwrap ( ) ;
19601930 assert_eq ! ( config. protocol, L7Protocol :: Rest ) ;
1961- // "terminate" is deprecated and treated as Auto.
19621931 assert_eq ! ( config. tls, TlsMode :: Auto ) ;
19631932 assert_eq ! ( config. enforcement, EnforcementMode :: Enforce ) ;
19641933 }
@@ -3421,30 +3390,37 @@ mod tests {
34213390 }
34223391
34233392 #[ test]
3424- fn validate_tls_terminate_deprecated_warning ( ) {
3425- let data = serde_json:: json!( {
3426- "network_policies" : {
3427- "test" : {
3428- "endpoints" : [ {
3429- "host" : "api.example.com" ,
3430- "port" : 443 ,
3431- "tls" : "terminate" ,
3432- "protocol" : "rest" ,
3433- "access" : "full"
3434- } ] ,
3435- "binaries" : [ ]
3393+ fn validate_rejects_unknown_endpoint_modes_without_warning ( ) {
3394+ for ( field, value) in [
3395+ ( "tls" , "terminate" ) ,
3396+ ( "tls" , "passthrough" ) ,
3397+ ( "enforcement" , "enforcee" ) ,
3398+ ( "access" , "read_only" ) ,
3399+ ] {
3400+ let mut endpoint = serde_json:: json!( {
3401+ "host" : "api.example.com" ,
3402+ "port" : 443 ,
3403+ "protocol" : "rest" ,
3404+ "access" : "full"
3405+ } ) ;
3406+ endpoint[ field] = value. into ( ) ;
3407+ let data = serde_json:: json!( {
3408+ "network_policies" : {
3409+ "test" : { "endpoints" : [ endpoint] , "binaries" : [ ] }
34363410 }
3437- }
3438- } ) ;
3439- let ( errors, warnings) = validate_l7_policies ( & data) ;
3440- assert ! (
3441- errors. is_empty( ) ,
3442- "deprecated tls should not error: {errors:?}"
3443- ) ;
3444- assert ! (
3445- warnings. iter( ) . any( |w| w. contains( "deprecated" ) ) ,
3446- "should warn about deprecated tls: {warnings:?}"
3447- ) ;
3411+ } ) ;
3412+
3413+ let ( errors, warnings) = validate_l7_policies ( & data) ;
3414+ assert ! (
3415+ errors. iter( ) . any( |e| e. contains( "test.endpoints[0]" )
3416+ && e. contains( & format!( "unknown {field} value '{value}'" ) ) ) ,
3417+ "{field}: {value} should be rejected: {errors:?}"
3418+ ) ;
3419+ assert ! (
3420+ !warnings. iter( ) . any( |w| w. contains( "deprecated" ) ) ,
3421+ "{field}: {value} should not warn: {warnings:?}"
3422+ ) ;
3423+ }
34483424 }
34493425
34503426 #[ test]
0 commit comments