简体   繁体   English

如何保护Class.forName(“com.mysql.jdbc.Driver”)?

[英]How to secure Class.forName("com.mysql.jdbc.Driver)?

I ran security scan on our application and one of the security issues that came up with is "Download of Code Without Integrity Check". 我在我们的应用程序上运行了安全扫描,其中一个安全问题是“下载没有完整性检查的代码”。 This risk points of the line at Class.forName("com.mysql.jdbc.Driver"); Class.forName("com.mysql.jdbc.Driver");中该行的风险点Class.forName("com.mysql.jdbc.Driver");

I have not able to find out 我无法找到答案

  1. how do I secure the above line of code? 我如何保护上面的代码?
  2. How do I make sure parameter for forName("") is not malicious class that I would be loading. 如何确保forName("")参数不是我要加载的恶意类。

Note: I am using Java 1.7 on our live environment. 注意:我在我们的实时环境中使用Java 1.7。 We do not have a security policy/SecurityManager in place. 我们没有安全策略/ SecurityManager。

Edit: Security Scan used is Checkmarx. 编辑:使用的安全扫描是Checkmarx。

With recent JDBC drivers there's no need to do the Class.forName() registration anymore. 使用最近的JDBC驱动程序 ,不再需要进行Class.forName()注册。 Update your driver if it's old (not JDBC4 or newer), and you'll be able to remove the line altogether. 如果驱动程序已经过时(不是JDBC4或更新版本),请更新驱动程序,并且您将能够完全删除该驱动程序。

The security issue seems to refer to this which would mean that the attacker has already access to the classpath, and therefore can cause plenty of damage in other ways as well. 安全问题似乎是指意味着攻击者已经访问了类路径,因此也可能在其他方面造成大量破坏。 The suggested solution of checking a checksum at that point may not be of too much help. 在该点检查校验和的建议解决方案可能没有太多帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 的Class.forName(“com.mysql.jdbc.Driver”)。的newInstance() - Class.forName(“com.mysql.jdbc.Driver”).newInstance() ClassNotFoundException Class.forName(“ com.mysql.jdbc.Driver”); - ClassNotFoundException Class.forName(“com.mysql.jdbc.Driver”); Class.forName(“ com.mysql.jdbc.Driver”)中的ClassNotFoundException; - ClassNotFoundException from Class.forName(“com.mysql.jdbc.Driver”); 无法通过class.forName(“ com.mysql.jdbc.Driver”)加载com.mysql.jdbc.Driver类 - Couldn't load class com.mysql.jdbc.Driver by class.forName(“com.mysql.jdbc.Driver”) Class.forName("com.mysql.jdbc.Driver") 没有在该类的 jar 文件中查找 - Class.forName("com.mysql.jdbc.Driver") is not looking in jar file for the class Class.forName(“ com.mysql.jdbc.Driver”)在Raspberry Pi上不起作用 - Class.forName(“com.mysql.jdbc.Driver”) does not work on Raspberry Pi 这究竟做了什么Class.forName(“com.mysql.jdbc.Driver”)。newInstance(); - what exactly does this do Class.forName(“com.mysql.jdbc.Driver”).newInstance(); 与Java applet相关的Class.forName(“ com.mysql.jdbc.Driver”)。newInstance()中的ClassNotFoundException - ClassNotFoundException in Class.forName(“com.mysql.jdbc.Driver”).newInstance() related to java applet 我必须在Java中的每个方法中编写Class.forname(“ com.mysql.jdbc.Driver”)吗? - do i have to write Class.forname(“com.mysql.jdbc.Driver”) in every method in java? 更好的理解 - Class.forName(“com.mysql.jdbc.Driver”)。newInstance(); - Better understaning - Class.forName(“com.mysql.jdbc.Driver”).newInstance ();
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM