mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-11-01 01:21:18 +01:00 
			
		
		
		
	Sandboxed URL creation to prevent SSRF attacks
This commit is contained in:
		
							parent
							
								
									271906097d
								
							
						
					
					
						commit
						8e0c02a151
					
				@ -1,5 +1,7 @@
 | 
			
		||||
package stirling.software.SPDF.utils;
 | 
			
		||||
 | 
			
		||||
import io.github.pixee.security.HostValidator;
 | 
			
		||||
import io.github.pixee.security.Urls;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileOutputStream;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
@ -57,7 +59,7 @@ public class GeneralUtils {
 | 
			
		||||
 | 
			
		||||
    public static boolean isValidURL(String urlStr) {
 | 
			
		||||
        try {
 | 
			
		||||
            new URL(urlStr);
 | 
			
		||||
            Urls.create(urlStr, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS);
 | 
			
		||||
            return true;
 | 
			
		||||
        } catch (MalformedURLException e) {
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user