File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,14 +47,22 @@ struct ProofSession {
4747 history : Vec < String > ,
4848}
4949
50+ const DEFAULT_ML_API_URL : & str = "http://127.0.0.1:8090" ;
51+
5052/// Start the HTTP server
5153pub async fn start_server ( port : u16 , host : String , enable_cors : bool ) -> Result < ( ) > {
5254 // Create HTTP client for Julia ML API
5355 let ml_client = Client :: builder ( )
5456 . timeout ( Duration :: from_secs ( 10 ) )
5557 . build ( ) ?;
5658
57- let ml_api_url = "http://127.0.0.1:8090" . to_string ( ) ;
59+ let ml_api_url = std:: env:: var ( "ECHIDNA_ML_API_URL" )
60+ . unwrap_or_else ( |_| DEFAULT_ML_API_URL . to_string ( ) ) ;
61+
62+ // Security: Validate that the ML API URL is either local or explicitly allowed
63+ if !ml_api_url. starts_with ( "http://127.0.0.1" ) && !ml_api_url. starts_with ( "http://localhost" ) {
64+ info ! ( "⚠ Untrusted ML API URL detected: {}. Baseline security policy requires local or trusted endpoint." , ml_api_url) ;
65+ }
5866
5967 // Test Julia ML connection
6068 match ml_client. get ( format ! ( "{}/health" , ml_api_url) ) . send ( ) . await {
You can’t perform that action at this time.
0 commit comments