@@ -307,32 +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:: ConfigStateChangeBuilder :: new ( openshell_ocsf:: ctx:: ctx ( ) )
312- . severity ( openshell_ocsf:: SeverityId :: Medium )
313- . status ( openshell_ocsf:: StatusId :: Success )
314- . state ( openshell_ocsf:: StateId :: Other , "deprecated" )
315- . message (
316- "'tls: terminate' is deprecated; TLS termination is now automatic. \
317- Use 'tls: skip' to explicitly disable. This field will be removed in a future version.",
318- )
319- . build ( ) ;
320- openshell_ocsf:: ocsf_emit!( event) ;
321- TlsMode :: Auto
322- }
323- "passthrough" => {
324- let event = openshell_ocsf:: ConfigStateChangeBuilder :: new ( openshell_ocsf:: ctx:: ctx ( ) )
325- . severity ( openshell_ocsf:: SeverityId :: Medium )
326- . status ( openshell_ocsf:: StatusId :: Success )
327- . state ( openshell_ocsf:: StateId :: Other , "deprecated" )
328- . message (
329- "'tls: passthrough' is deprecated; TLS termination is now automatic. \
330- Use 'tls: skip' to explicitly disable. This field will be removed in a future version.",
331- )
332- . build ( ) ;
333- openshell_ocsf:: ocsf_emit!( event) ;
334- TlsMode :: Auto
335- }
336310 "" => TlsMode :: Auto ,
337311 _ => unreachable ! ( "endpoint modes were validated above" ) ,
338312 } ;
@@ -474,7 +448,6 @@ pub fn endpoint_path_matches(pattern: &str, path: &str) -> bool {
474448pub fn parse_tls_mode ( val : & regorus:: Value ) -> TlsMode {
475449 match get_object_str ( val, "tls" ) . as_deref ( ) {
476450 Some ( "skip" ) => TlsMode :: Skip ,
477- // "terminate" and "passthrough" are deprecated aliases (logged by parse_l7_config); fall through to Auto.
478451 _ => TlsMode :: Auto ,
479452 }
480453}
@@ -1277,6 +1250,12 @@ pub fn validate_l7_policies(data_json: &serde_json::Value) -> (Vec<String>, Vec<
12771250 ) ;
12781251 let loc = format ! ( "{name}.endpoints[{i}]" ) ;
12791252
1253+ errors. extend (
1254+ validate_endpoint_modes ( tls, enforcement, access)
1255+ . into_iter ( )
1256+ . map ( |reason| format ! ( "{loc}: {reason}" ) ) ,
1257+ ) ;
1258+
12801259 if protocol == "mcp" {
12811260 if host. trim ( ) . is_empty ( ) {
12821261 errors. push ( format ! (
@@ -1493,13 +1472,6 @@ pub fn validate_l7_policies(data_json: &serde_json::Value) -> (Vec<String>, Vec<
14931472 }
14941473 }
14951474
1496- // Deprecated tls values: warn but don't error
1497- if tls == "terminate" || tls == "passthrough" {
1498- warnings. push ( format ! (
1499- "{loc}: 'tls: {tls}' is deprecated; TLS termination is now automatic. Use 'tls: skip' to disable."
1500- ) ) ;
1501- }
1502-
15031475 // tls: skip with L7 on port 443 won't work
15041476 if tls == "skip" && !protocol. is_empty ( ) && ports. contains ( & 443 ) {
15051477 warnings. push ( format ! (
@@ -1514,10 +1486,6 @@ pub fn validate_l7_policies(data_json: &serde_json::Value) -> (Vec<String>, Vec<
15141486 ) ) ;
15151487 }
15161488
1517- // port 443 + rest + tls: skip — L7 won't work (already handled above)
1518- // The old warning about missing `tls: terminate` is no longer needed
1519- // because TLS termination is now automatic.
1520-
15211489 // Per-rule deny_rules validation (semantic checks handled by
15221490 // shared validator above).
15231491 if has_deny_rules {
@@ -1957,12 +1925,11 @@ mod tests {
19571925 #[ test]
19581926 fn parse_l7_config_rest_enforce ( ) {
19591927 let val = regorus:: Value :: from_json_str (
1960- r#"{"protocol": "rest", "tls": "terminate", " enforcement": "enforce", "host": "api.example.com", "port": 443}"# ,
1928+ r#"{"protocol": "rest", "enforcement": "enforce", "host": "api.example.com", "port": 443}"# ,
19611929 )
19621930 . unwrap ( ) ;
19631931 let config = parse_l7_config ( & val) . unwrap ( ) ;
19641932 assert_eq ! ( config. protocol, L7Protocol :: Rest ) ;
1965- // "terminate" is deprecated and treated as Auto.
19661933 assert_eq ! ( config. tls, TlsMode :: Auto ) ;
19671934 assert_eq ! ( config. enforcement, EnforcementMode :: Enforce ) ;
19681935 }
@@ -3425,30 +3392,37 @@ mod tests {
34253392 }
34263393
34273394 #[ test]
3428- fn validate_tls_terminate_deprecated_warning ( ) {
3429- let data = serde_json:: json!( {
3430- "network_policies" : {
3431- "test" : {
3432- "endpoints" : [ {
3433- "host" : "api.example.com" ,
3434- "port" : 443 ,
3435- "tls" : "terminate" ,
3436- "protocol" : "rest" ,
3437- "access" : "full"
3438- } ] ,
3439- "binaries" : [ ]
3395+ fn validate_rejects_unknown_endpoint_modes_without_warning ( ) {
3396+ for ( field, value) in [
3397+ ( "tls" , "terminate" ) ,
3398+ ( "tls" , "passthrough" ) ,
3399+ ( "enforcement" , "enforcee" ) ,
3400+ ( "access" , "read_only" ) ,
3401+ ] {
3402+ let mut endpoint = serde_json:: json!( {
3403+ "host" : "api.example.com" ,
3404+ "port" : 443 ,
3405+ "protocol" : "rest" ,
3406+ "access" : "full"
3407+ } ) ;
3408+ endpoint[ field] = value. into ( ) ;
3409+ let data = serde_json:: json!( {
3410+ "network_policies" : {
3411+ "test" : { "endpoints" : [ endpoint] , "binaries" : [ ] }
34403412 }
3441- }
3442- } ) ;
3443- let ( errors, warnings) = validate_l7_policies ( & data) ;
3444- assert ! (
3445- errors. is_empty( ) ,
3446- "deprecated tls should not error: {errors:?}"
3447- ) ;
3448- assert ! (
3449- warnings. iter( ) . any( |w| w. contains( "deprecated" ) ) ,
3450- "should warn about deprecated tls: {warnings:?}"
3451- ) ;
3413+ } ) ;
3414+
3415+ let ( errors, warnings) = validate_l7_policies ( & data) ;
3416+ assert ! (
3417+ errors. iter( ) . any( |e| e. contains( "test.endpoints[0]" )
3418+ && e. contains( & format!( "unknown {field} value '{value}'" ) ) ) ,
3419+ "{field}: {value} should be rejected: {errors:?}"
3420+ ) ;
3421+ assert ! (
3422+ !warnings. iter( ) . any( |w| w. contains( "deprecated" ) ) ,
3423+ "{field}: {value} should not warn: {warnings:?}"
3424+ ) ;
3425+ }
34523426 }
34533427
34543428 #[ test]
0 commit comments