=============================================================================== Spotbugs XML Output =============================================================================== Potential Path Traversal (file read) java/io/FileInputStream.<init>(Ljava/lang/String;)V reads a file whose location might be specified by user input At ComponentFactory.java:[lines 24-247] In class fitnesse.ComponentFactory In method fitnesse.ComponentFactory.loadProperties(String) At ComponentFactory.java:[line 71] Sink method java/io/FileInputStream.<init>(Ljava/lang/String;)V Unknown source java/lang/StringBuilder.append(Ljava/lang/String;)Ljava/lang/StringBuilder; Unknown source java/lang/StringBuilder.append(Ljava/lang/String;)Ljava/lang/StringBuilder; Unknown source java/lang/StringBuilder.append(Ljava/lang/String;)Ljava/lang/StringBuilder; Unknown source java/lang/StringBuilder.toString()Ljava/lang/String; Sink method java/io/FileInputStream.<init>(Ljava/lang/String;)V At ComponentFactory.java:[line 47] At ComponentFactory.java:[line 64] At ComponentFactory.java:[line 70] At ComponentFactory.java:[line 80] At FitNesseSuite.java:[line 135] At FitNesseSuite.java:[line 287] At FitNesseMain.java:[line 108] =============================================================================== Code Snippet of ComponentFactory.java, FitNesseSuite.java, FitNesseMain.java: =============================================================================== ####### ComponentFactory.java 46 public ComponentFactory(String propertiesLocation) { 47 this(propertiesLocation, new Properties(), SymbolProvider.wikiParsingProvider); 48 } 49 50 public ComponentFactory(Properties properties) { 51 this(properties, SymbolProvider.wikiParsingProvider); 52 } 53 54 public ComponentFactory(Properties properties, SymbolProvider symbolProvider) { 55 this.propertiesLocation = null; 56 this.loadedProperties = properties; 57 propertiesAreLoaded = true; 58 this.symbolProvider = symbolProvider; 59 } 60 61 public ComponentFactory(String propertiesLocation, Properties properties, SymbolProvider symbolProvider) { 62 this.propertiesLocation = propertiesLocation; 63 this.loadedProperties = properties; 64 loadProperties(propertiesLocation); 65 this.symbolProvider = symbolProvider; 66 } 67 68 protected void loadProperties(String propertiesLocation) { 69 try { 70 String propertiesPath = propertiesLocation + "/" + PROPERTIES_FILE; 71 FileInputStream propertiesStream = new FileInputStream(propertiesPath); 72 loadedProperties.load(propertiesStream); 73 } catch (IOException e) { 74 // No properties files means all defaults are loaded 75 } 76 } 77 78 Properties getProperties() { 79 if (!propertiesAreLoaded) { 80 loadProperties(propertiesLocation); 81 propertiesAreLoaded = true; 82 } 83 return loadedProperties; 84 } ########## FitNesseSuite.java 123 public FitNesseSuite(Class suiteClass, RunnerBuilder builder) throws InitializationError { 124 super(suiteClass); 125 this.suiteClass = suiteClass; 126 this.suiteName = getSuiteName(suiteClass); 127 this.fitNesseDir = getFitnesseDir(suiteClass); 128 this.outputDir = getOutputDir(suiteClass); 129 this.suiteFilter = getSuiteFilter(suiteClass); 130 this.excludeSuiteFilter = getExcludeSuiteFilter(suiteClass); 131 this.debugMode = useDebugMode(suiteClass); 132 this.port = getPort(suiteClass); 133 134 try { 135 FitNesseContext context = initContext(this.fitNesseDir, port); 136 this.children = initChildren(context); 137 } catch (Exception e) { 138 throw new IllegalStateException(e); 139 } 140 } 284 private static FitNesseContext initContext(String rootPath, int port) throws Exception { 285 Builder builder = new Builder(); 286 WikiPageFactory wikiPageFactory = new WikiPageFactory(); 287 ComponentFactory componentFactory = new ComponentFactory(rootPath); 288 289 builder.port = port; 290 builder.rootPath = rootPath; 291 builder.rootDirectoryName = "FitNesseRoot"; 292 293 builder.pageTheme = componentFactory.getProperty(ComponentFactory.THEME); 294 builder.defaultNewPageContent = componentFactory 295 .getProperty(ComponentFactory.DEFAULT_NEWPAGE_CONTENT); 296 297 builder.root = wikiPageFactory.makeRootPage(builder.rootPath, 298 builder.rootDirectoryName, componentFactory); 299 300 builder.logger = null; 301 builder.authenticator = new PromiscuousAuthenticator(); 302 303 FitNesseContext context = builder.createFitNesseContext(); 304 return context; 305 } ######## FitNesseMain.java 104 private static FitNesseContext loadContext(Arguments arguments) 105 throws Exception { 106 Builder builder = new Builder(); 107 WikiPageFactory wikiPageFactory = new WikiPageFactory(); 108 ComponentFactory componentFactory = new ComponentFactory(arguments.getRootPath()); ... ... ...