@@ -3,7 +3,6 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngressTest do
33
44 import CodexPooler.PoolerFixtures
55
6- alias CodexPooler.Accounting . { Attempt , Request }
76 alias CodexPooler.Catalog.PricingSnapshot
87 alias CodexPooler.FakeUpstream
98 alias CodexPooler.Gateway.OperationalSettings
@@ -121,7 +120,6 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngressTest do
121120
122121 for { method , path } <- [
123122 { :get , "/backend-api/codex/models" } ,
124- { :get , "/backend-api/codex/agent-identities/jwks" } ,
125123 { :post , "/backend-api/codex/responses" } ,
126124 { :get , "/backend-api/codex/v1/responses" } ,
127125 { :post , "/backend-api/codex/v1/responses" } ,
@@ -131,7 +129,6 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngressTest do
131129 { :post , "/backend-api/files/file_123/uploaded" } ,
132130 { :post , "/backend-api/transcribe" } ,
133131 { :get , "/wham/usage" } ,
134- { :get , "/backend-api/wham/agent-identities/jwks" } ,
135132 { :get , "/backend-api/wham/usage" }
136133 ] do
137134 conn = conn |> recycle ( ) |> remote_ip ( { 198 , 51 , 100 , 20 } ) |> dispatch ( method , path )
@@ -270,7 +267,6 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngressTest do
270267 "/backend-api/codex/v1/chat/completions" ,
271268 "/backend-api/codex/images/generations" ,
272269 "/backend-api/codex/images/edits" ,
273- "/backend-api/codex/alpha/search" ,
274270 "/backend-api/files" ,
275271 "/backend-api/files/file_123/uploaded"
276272 ] do
@@ -284,56 +280,29 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngressTest do
284280 end
285281 end
286282
287- @ tag :feature_control_plane_alpha_search
288- test "authenticates alpha search before malformed, compressed, or large bodies" , % { conn: conn } do
289- setup_runtime_ingress ( % OperationalSettings { max_compressed_body_bytes: 1 } )
290- upstream = start_upstream ( FakeUpstream . json_response ( % { "unexpected" => true } ) )
291- _setup = gateway_setup ( upstream )
292-
293- malformed_conn =
294- conn
295- |> recycle ( )
296- |> put_req_header ( "content-type" , "application/json" )
297- |> post ( "/backend-api/codex/alpha/search" , ~s( {"id":) )
298-
299- assert json_response ( malformed_conn , 401 ) [ "error" ] [ "code" ] == "api_key_missing"
300-
301- compressed_conn =
302- conn
303- |> recycle ( )
304- |> compressed_post (
305- "/backend-api/codex/alpha/search" ,
306- "gzip" ,
307- :zlib . gzip ( ~s( {"id":"search_alpha_fixture"}) )
308- )
309-
310- assert json_response ( compressed_conn , 401 ) [ "error" ] [ "code" ] == "api_key_missing"
311-
312- large_conn =
313- conn
314- |> recycle ( )
315- |> put_req_header ( "content-type" , "application/json" )
316- |> post (
317- "/backend-api/codex/alpha/search" ,
318- ~s( {"id":"search_alpha_fixture","input":") <>
319- String . duplicate ( "a" , 10_000 ) <> ~s( "})
320- )
321-
322- assert json_response ( large_conn , 401 ) [ "error" ] [ "code" ] == "api_key_missing"
323- assert FakeUpstream . count ( upstream ) == 0
324- assert Repo . aggregate ( Request , :count , :id ) == 0
325- assert Repo . aggregate ( Attempt , :count , :id ) == 0
326- end
327-
328- test "authenticates realtime SDP before controller raw body handling" , % { conn: conn } do
283+ test "pruned backend helper routes fall through as absent without ingress auth" , % { conn: conn } do
329284 setup_runtime_ingress ( % OperationalSettings { } )
330285
331- conn =
332- conn
333- |> put_req_header ( "content-type" , "application/sdp" )
334- |> post ( "/backend-api/codex/realtime/calls" , "v=0\r \n s=codex-pooler-test\r \n " )
286+ for { method , path , content_type , body } <- [
287+ { "GET" , "/backend-api/codex/agent-identities/jwks?kid=absent" , nil , nil } ,
288+ { "GET" , "/backend-api/wham/agent-identities/jwks?kid=absent" , nil , nil } ,
289+ { "POST" , "/backend-api/codex/thread/goal/get" , "application/json" , "{}" } ,
290+ { "POST" , "/backend-api/codex/thread/goal/set" , "application/json" , "{}" } ,
291+ { "POST" , "/backend-api/codex/thread/goal/clear" , "application/json" , "{}" } ,
292+ { "POST" , "/backend-api/codex/analytics-events/events" , "application/json" , "{}" } ,
293+ { "POST" , "/backend-api/codex/memories/trace_summarize" , "application/json" , "{}" } ,
294+ { "POST" , "/backend-api/codex/alpha/search" , "application/json" , "{}" } ,
295+ { "POST" , "/backend-api/codex/realtime/calls" , "application/sdp" ,
296+ "v=0\r \n s=codex-pooler-test\r \n " } ,
297+ { "POST" , "/backend-api/codex/safety/arc" , "application/json" , "{}" }
298+ ] do
299+ conn =
300+ conn
301+ |> recycle ( )
302+ |> dispatch_absent_backend_helper ( method , path , content_type , body )
335303
336- assert json_response ( conn , 401 ) [ "error" ] [ "code" ] == "api_key_missing"
304+ assert response ( conn , 404 ) =~ "Not Found"
305+ end
337306 end
338307 end
339308
@@ -742,6 +711,15 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngressTest do
742711 defp dispatch ( conn , :get , path ) , do: get ( conn , path )
743712 defp dispatch ( conn , :post , path ) , do: post ( conn , path , % { } )
744713
714+ defp dispatch_absent_backend_helper ( conn , "GET" , path , _content_type , _body ) ,
715+ do: get ( conn , path )
716+
717+ defp dispatch_absent_backend_helper ( conn , "POST" , path , content_type , body ) do
718+ conn
719+ |> put_req_header ( "content-type" , content_type )
720+ |> post ( path , body )
721+ end
722+
745723 defp deflate ( body ) when is_map ( body ) , do: body |> Jason . encode! ( ) |> :zlib . compress ( )
746724
747725 defp zstd ( body ) when is_map ( body ) do
0 commit comments