日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

sonar 规则之漏洞类型

發(fā)布時(shí)間:2023/12/19 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 sonar 规则之漏洞类型 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
漏洞類型:

1、"@RequestMapping" methods should be "public"
漏洞 阻斷
標(biāo)注了RequestMapping是controller是處理web請(qǐng)求。既使方法修飾為private,同樣也能被外部調(diào)用,因?yàn)閟pring通過(guò)反射調(diào)用方法,沒(méi)有檢查方法可視度,
2、"enum" fields should not be publicly mutable
漏洞 次要
枚舉類域不應(yīng)該是public,也不應(yīng)該進(jìn)行set
3、"File.createTempFile" should not be used to create a directory
漏洞 嚴(yán)重
File.createTempFile不應(yīng)該被用來(lái)創(chuàng)建目錄
4、"HttpServletRequest.getRequestedSessionId()" should not be used
漏洞 嚴(yán)重
HttpServletRequest.getRequestedSessionId()返回客戶端瀏覽器會(huì)話id不要用,用HttpServletRequest.getSession().getId()
5、"javax.crypto.NullCipher" should not be used for anything other than testing
漏洞 阻斷
NullCipher類提供了一種“身份密碼”,不會(huì)以任何方式轉(zhuǎn)換或加密明文。 因此,密文與明文相同。 所以這個(gè)類應(yīng)該用于測(cè)試,從不在生產(chǎn)代碼中。
6、"public static" fields should be constant
漏洞 次要
public static 域應(yīng)該 final
7、Class variable fields should not have public accessibility
漏洞 次要
類變量域應(yīng)該是private,通過(guò)set,get進(jìn)行操作
8、Classes should not be loaded dynamically
漏洞 嚴(yán)重
不應(yīng)該動(dòng)態(tài)加載類,動(dòng)態(tài)加載的類可能包含由靜態(tài)類初始化程序執(zhí)行的惡意代碼.
Class clazz = Class.forName(className); // Noncompliant
9、Cookies should be "secure"
漏洞 次要
Cookie c = new Cookie(SECRET, secret); // Noncompliant; cookie is not secure
response.addCookie(c);
正:
Cookie c = new Cookie(SECRET, secret);
c.setSecure(true);
response.addCookie(c);
10、Credentials should not be hard-coded
漏洞 阻斷
憑證不應(yīng)該硬編碼
11、Cryptographic RSA algorithms should always incorporate OAEP (Optimal Asymmetric Encryption Padding)
漏洞 嚴(yán)重
加密RSA算法應(yīng)始終包含OAEP(最優(yōu)非對(duì)稱加密填充)
12、Default EJB interceptors should be declared in "ejb-jar.xml"
漏洞 阻斷
默認(rèn)EJB攔截器應(yīng)在“ejb-jar.xml”中聲明
13、Defined filters should be used
漏洞 嚴(yán)重
web.xml文件中定義的每個(gè)過(guò)濾器都應(yīng)該在<filter-mapping>元素中使用。 否則不會(huì)調(diào)用此類過(guò)濾器。
14、Exceptions should not be thrown from servlet methods
漏洞 次要
不應(yīng)該從servlet方法拋出異常
15、HTTP referers should not be relied on
漏洞 嚴(yán)重
不應(yīng)依賴于http,將這些參數(shù)值中止后可能是安全的,但絕不應(yīng)根據(jù)其內(nèi)容作出決定。
如:
String referer = request.getHeader("referer"); // Noncompliant
if(isTrustedReferer(referer)){
//..
}
16、IP addresses should not be hardcoded
漏洞 次要
ip 地址不應(yīng)該硬編碼
17、Member variable visibility should be specified
漏洞 次要
應(yīng)指定成員變量的可見性
18、Members of Spring components should be injected
漏洞 嚴(yán)重
spring組件的成員應(yīng)注入,單例注入非靜態(tài)成員共享會(huì)產(chǎn)生風(fēng)險(xiǎn)
19、Mutable fields should not be "public static"
漏洞 次要
多變?cè)谟虿粦?yīng)為 public static
20、Neither DES (Data Encryption Standard) nor DESede (3DES) should be used
漏洞 阻斷
不應(yīng)使用DES(數(shù)據(jù)加密標(biāo)準(zhǔn))和DESEDE(3DES)
21、Only standard cryptographic algorithms should be used
漏洞 嚴(yán)重
標(biāo)準(zhǔn)的加密算法如 SHA-256, SHA-384, SHA-512等,非標(biāo)準(zhǔn)算法是危險(xiǎn)的,可能被功能者攻破算法
22、Pseudorandom number generators (PRNGs) should not be used in secure contexts
漏洞 嚴(yán)重
偽隨機(jī)數(shù)生成器(PRNG)不應(yīng)在安全上下文中使用
23、Return values should not be ignored when they contain the operation status code
漏洞 次要
當(dāng)函數(shù)調(diào)用的返回值包含操作狀態(tài)代碼時(shí),應(yīng)該測(cè)試此值以確保操作成功完成。
24、Security constraints should be definedin
漏洞 阻斷
應(yīng)定義安全約束,當(dāng)web.xml文件沒(méi)有<security-constraint>元素時(shí),此規(guī)則引發(fā)了一個(gè)問(wèn)題
25、SHA-1 and Message-Digest hash algorithms should not be used
漏洞 嚴(yán)重
不應(yīng)該使用SHA-1和消息摘要散列算法,已證實(shí)不再安全
26、SQL binding mechanisms should be used
漏洞 阻斷
應(yīng)該使用SQL綁定機(jī)制
27、Struts validation forms should have unique names
漏洞 阻斷
struts驗(yàn)證表單應(yīng)有唯一名稱
28、Throwable.printStackTrace(...) should not be called
漏洞 次要
Throwable.printStackTrace(...)會(huì)打印異常信息,但會(huì)暴露敏感信息
29、Untrusted data should not be stored in sessions
漏洞 主要
不受信任的數(shù)據(jù)不應(yīng)存儲(chǔ)在會(huì)話中。
Web會(huì)話中的數(shù)據(jù)被認(rèn)為在“信任邊界”內(nèi)。 也就是說(shuō),它被認(rèn)為是值得信賴的。 但存儲(chǔ)未經(jīng)身份驗(yàn)證的用戶未經(jīng)驗(yàn)證的數(shù)據(jù)違反信任邊界,并可能導(dǎo)致該數(shù)據(jù)被不當(dāng)使用。
30、Values passed to LDAP queries should be sanitized
漏洞 嚴(yán)重
傳遞到LDAP查詢的值應(yīng)該被清理
31、Values passed to OS commands should be sanitized
漏洞 嚴(yán)重
傳遞給OS命令的值應(yīng)該被清理
32、Web applications should not have a "main" method
漏洞 嚴(yán)重
web 應(yīng)用中不應(yīng)有一個(gè)main方法

總結(jié)

以上是生活随笔為你收集整理的sonar 规则之漏洞类型的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。