@@ -1396,6 +1396,16 @@ async fn native_wasm_cache_store_forbidden_tag_fails_closed() {
13961396 . assert_service_unavailable ( ) ;
13971397}
13981398
1399+ #[ tokio:: test]
1400+ async fn native_wasm_cache_store_duplicate_header_fails_closed ( ) {
1401+ wasm_cache_store_failure_response (
1402+ WasmPluginBody :: CacheStoreDuplicateHeader ,
1403+ "header-duplicate" ,
1404+ )
1405+ . await
1406+ . assert_service_unavailable ( ) ;
1407+ }
1408+
13991409#[ tokio:: test]
14001410async fn native_wasm_cache_store_deny_wins_over_earlier_skip ( ) {
14011411 let fixture = WasmRouteFixture :: new ( & [
@@ -1526,6 +1536,7 @@ async fn wasm_cache_store_failure_response(
15261536 "ttl" => & [ ( "/static/store-ttl.png" , "hidden" ) ] ,
15271537 "ttl-duplicate" => & [ ( "/static/store-ttl-duplicate.png" , "hidden" ) ] ,
15281538 "tag" => & [ ( "/static/store-tag.png" , "hidden" ) ] ,
1539+ "header-duplicate" => & [ ( "/static/store-header-duplicate.png" , "hidden" ) ] ,
15291540 _ => & [ ( "/static/store-failure.png" , "hidden" ) ] ,
15301541 } ;
15311542 let path = responses[ 0 ] . 0 ;
@@ -1618,6 +1629,7 @@ enum WasmPluginBody {
16181629 CacheStoreForbiddenTag ,
16191630 CacheStoreHeader ,
16201631 CacheStoreForbiddenHeader ,
1632+ CacheStoreDuplicateHeader ,
16211633 CacheLookupPolicyExample ,
16221634 CacheStorePolicyExample ,
16231635 Trap ,
@@ -1882,6 +1894,23 @@ impl WasmPluginBody {
18821894 "#
18831895 . to_owned ( )
18841896 }
1897+ Self :: CacheStoreDuplicateHeader => {
1898+ r#"
1899+ (module
1900+ (import "fluxheim_policy_v1" "set_cache_store_header" (func $set_cache_store_header (param i32 i32) (result i32)))
1901+ (func (export "fluxheim_cache_store") (result i32)
1902+ i32.const 1
1903+ i32.const 1
1904+ call $set_cache_store_header
1905+ drop
1906+ i32.const 1
1907+ i32.const 2
1908+ call $set_cache_store_header
1909+ drop
1910+ i32.const 0))
1911+ "#
1912+ . to_owned ( )
1913+ }
18851914 Self :: CacheLookupPolicyExample => {
18861915 include_str ! ( "../../../../examples/wasm/cache-lookup-policy.wat" ) . to_owned ( )
18871916 }
@@ -1958,7 +1987,8 @@ fn wasm_plugin_phases(body: WasmPluginBody) -> Vec<fluxheim_config::WasmPluginPh
19581987 | WasmPluginBody :: CacheStoreDuplicateTtl
19591988 | WasmPluginBody :: CacheStoreForbiddenTag
19601989 | WasmPluginBody :: CacheStoreHeader
1961- | WasmPluginBody :: CacheStoreForbiddenHeader => {
1990+ | WasmPluginBody :: CacheStoreForbiddenHeader
1991+ | WasmPluginBody :: CacheStoreDuplicateHeader => {
19621992 vec ! [ fluxheim_config:: WasmPluginPhase :: CacheStore ]
19631993 }
19641994 WasmPluginBody :: CacheLookupPolicyExample => {
0 commit comments