File tree Expand file tree Collapse file tree
apps/src-tauri/src/extensions/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -600,10 +600,12 @@ mod tests {
600600 }
601601
602602 #[ test]
603- fn test_validate_url_rejects_http ( ) {
603+ fn test_validate_url_auto_upgrades_http_to_https ( ) {
604+ // Remote HTTP URLs are auto-upgraded to HTTPS (not rejected)
604605 let result = validate_url_security ( "http://marketplace.example.com/ext.zip" ) ;
605- assert ! ( result. is_err( ) ) ;
606- assert ! ( result. unwrap_err( ) . contains( "HTTPS" ) ) ;
606+ assert ! ( result. is_ok( ) ) ;
607+ // Non-HTTP/HTTPS schemes are still rejected
608+ assert ! ( validate_url_security( "ftp://marketplace.example.com/ext.zip" ) . is_err( ) ) ;
607609 }
608610
609611 #[ test]
@@ -624,8 +626,12 @@ mod tests {
624626 }
625627
626628 #[ test]
627- fn test_validate_url_rejects_localhost ( ) {
628- assert ! ( validate_url_security( "https://localhost/ext.zip" ) . is_err( ) ) ;
629+ fn test_validate_url_allows_localhost_rejects_internal ( ) {
630+ // Localhost is allowed for local development
631+ assert ! ( validate_url_security( "https://localhost/ext.zip" ) . is_ok( ) ) ;
632+ assert ! ( validate_url_security( "http://localhost/ext.zip" ) . is_ok( ) ) ;
633+ assert ! ( validate_url_security( "http://localhost:3000/ext.zip" ) . is_ok( ) ) ;
634+ // Internal/private domains are still rejected
629635 assert ! ( validate_url_security( "https://something.local/ext.zip" ) . is_err( ) ) ;
630636 assert ! ( validate_url_security( "https://service.internal/ext.zip" ) . is_err( ) ) ;
631637 }
You can’t perform that action at this time.
0 commit comments