开发者

Writing rules in Fortify

开发者 https://www.devze.com 2023-04-10 21:12 出处:网络
Does anybody know how to write a rule in HP Fortify S开发者_如何学运维CA to check for an XML tag value in an XLM file?

Does anybody know how to write a rule in HP Fortify S开发者_如何学运维CA to check for an XML tag value in an XLM file?

I have an XML like this with a regular expression and want to write a rule which checks whether the element matches a regex.

<xml>
 <email>[a-z]@.com]</email>
</xml>


This is done with an XML style ConfigurationRule. I'm not sure if you want to match the value against a regular expression, or determine that the value is itself a regular expression. But regardless I will provide the structure of the rule and you are on your own for the pattern.

<?xml version="1.0" encoding="UTF-8"?>
    <RulePack xmlns="xmlns://www.fortifysoftware.com/schema/rules"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RulePack">
        <RulePackID>D1B37203-B532-4F4F-BF1F-BA8796CABF21</RulePackID>
        <SKU>SKU-D1B37203-B532-4F4F-BF1F-BA8796CABF21</SKU>
        <Name><![CDATA[ rulepack name ]]></Name>
        <Version>1.0</Version>
        <Description><![CDATA[Description for .xml]]></Description>
        <Rules version="3.11">
            <RuleDefinitions>
                <ConfigurationRule formatVersion="3.11">
                    <RuleID>1C80C1A2-10DF-40C3-B1B7-FCC3D7BD42F7</RuleID>
                    <VulnKingdom>Code Quality</VulnKingdom>
                    <VulnCategory>Email in XYZ Configuration</VulnCategory>
                    <DefaultSeverity>5.0</DefaultSeverity>
                    <Description formatVersion="3.2"></Description>
                    <ConfigFile type="xml">
                        <Pattern>test.*\.xml</Pattern>
                    </ConfigFile>
                    <XPathMatch expression="/xml/email[text()='abc@foo']" reporton="/xml/email" />
                </ConfigurationRule>
            </RuleDefinitions>
        </Rules>
    </RulePack>
0

精彩评论

暂无评论...
验证码 换一张
取 消