How to write Fortify custom rules language specific?

谁都会走 提交于 2019-12-11 19:27:15

问题


I'm creating some customs rules using Fortify but I wonder if there is any way to customise that rules so they can be language specific.

The reason for that is to be able to give custom descriptions in Java and in .NET about SQL injection for instance and Custom references so they can be language specific.

It seems like Fortify maps custom rules by category,but the issue comes when we have two packages , one for .NET and other for Java and both of them exposes a category called Cross-Site Scripting.

Do you guys know how to make this rules language-specific?

Thanks.


回答1:


Use the language attribute of the Rule like here:

<StructuralRule formatVersion="3.8" language="dotnet">
                <RuleID>1537A69A-F7EA-4D14-9F8F-0CC17806780A</RuleID>
                <VulnKingdom>Input Validation and Representation</VulnKingdom>
                <VulnCategory>SQL Injection</VulnCategory>
                <DefaultSeverity>2.0</DefaultSeverity>
                <Description></Description>
                <Predicate><![CDATA[
                    FunctionCall fc: fc.function is [Function f: f.name == "set_CommandText" and 
                                                                 f.enclosingClass.supers contains [Class c: c.name == "System.Data.IDbCommand"]] and
                                     not fc.enclosingFunction contains [FunctionCall call: call.function is 
                                                    [Function f1: f1.name == "set_CommandType" and
                                                                  f1.enclosingClass.supers contains [Class c1: c1.name == "System.Data.IDbCommand"]] and
                                                                        call.arguments[0].constantValue == 4]
                ]]></Predicate>
</StructuralRule>


来源:https://stackoverflow.com/questions/18521120/how-to-write-fortify-custom-rules-language-specific

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!