@@ -34,7 +34,9 @@ fn create_test_config(port: u16) -> HttpInputConfig {
3434 routing_rules : None ,
3535 response_control : None ,
3636 forward_headers : vec ! [ ] ,
37- cors_origins : vec ! [ "*" . to_string( ) ] ,
37+ // Explicit origin (wildcard "*" is now refused at startup — see
38+ // SECURITY_AUDIT.md M1). Use the loopback origin the test clients hit.
39+ cors_origins : vec ! [ format!( "http://127.0.0.1:{}" , port) ] ,
3840 audit_enabled : true ,
3941 webhook_verify : None ,
4042 }
@@ -310,15 +312,19 @@ async fn test_agent_interaction_and_invocation() {
310312#[ cfg( feature = "http-input" ) ]
311313#[ tokio:: test]
312314async fn test_cors_headers_when_enabled ( ) {
313- let ( _handle, base_url, _port ) = start_test_server ( ) . await ;
315+ let ( _handle, base_url, port ) = start_test_server ( ) . await ;
314316 let client = reqwest:: Client :: new ( ) ;
315317
316- // Send an OPTIONS request to check CORS headers
318+ // Send an OPTIONS request from the configured allowed origin (the loopback
319+ // URL the test fixture seeds into cors_origins). Wildcard "*" is no longer
320+ // accepted (SECURITY_AUDIT.md M1) so the request Origin must match the
321+ // allowlist for the response to carry Access-Control-Allow-Origin.
322+ let allowed_origin = format ! ( "http://127.0.0.1:{}" , port) ;
317323 let response = timeout (
318324 Duration :: from_secs ( 5 ) ,
319325 client
320326 . request ( reqwest:: Method :: OPTIONS , format ! ( "{}/webhook" , base_url) )
321- . header ( "Origin" , "https://example.com" )
327+ . header ( "Origin" , & allowed_origin )
322328 . header ( "Access-Control-Request-Method" , "POST" )
323329 . send ( ) ,
324330 )
0 commit comments