Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有人可以帮我了解以下 Vera 代码罐头错误的 Java 编码解决方案吗?
我正在创建一个文件并将文件位置作为参数传递。
File file1=new File(filePath); **CWE-73: External Control of File Name or Path**
您可以使用:
Validator validator = ESAPI.validator(); validator.getValidDirectoryPath(..) // to validate the directory path validator.getValidFileName(...) // to validate the file name
然后使用它们来创建您的文件