java - SonarQube 规则:Spring Boot 应用程序中的“使用命令行参数是安全敏感的”
问题描述
SonarQube 只是在非常基本的 Spring Boot 应用程序中显示了一个严重的安全问题。在主要方法中。
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
SonarQube 想要我Make sure that command line arguments are used safely here.
我在 StackOverflow 和 Google 上都搜索了这个,我很惊讶我找不到任何关于这个问题的评论。我几乎可以肯定该SpringApplication.run
方法内部已经进行了一些安全检查。而且,我什至不记得有人在调用SpringApplication.run
. 我只是想将其标记为误报并继续前进。
这个问题的一部分也在这里问:SonarQube 在 Spring Framework 控制器和 Spring Framework Application 主类中显示安全错误
是误报吗?
解决方案
如果你没有使用任何命令行参数,那么你可以避免在 run 方法中提及 args 参数。就像下面的代码。
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
这将消除声纳热点问题。
推荐阅读
- c++ - 将用户价值与枚举中的价值进行比较
- machine-learning - 如何为 2D 输入和输出创建深度学习模型?
- python - xarray.Dataset.weighted(...) 的问题
- javafx - 如何从主控制器类将动作侦听器设置为对话框确定按钮
- ggplot2 - 为什么在 RStudio 中清除我的全局环境可以解决我的 ggplot 缺失轴问题?
- python - /admin/accounts/picture/ 处的 OperationalError 没有这样的表:accounts_picture
- c++ - 为什么 boost::asio::ip::tcp::basic_stream_socket::available 运行时间长?
- javascript - 随机生日的概率
- html - 减小页面宽度时防止导航项换行
- c++ - 使用指向结构的指针序列化结构